Unistep ® - Microsoft Visio diagram animation add-in


Unistep technology

Information on how I developed Unistep

Unistep is an add-in for Microsoft Visio. During the development of this piece of software I had to solve various little problems. For some I found great help on the Net. I thought some solutions may be of interest for other people interested in developing such software.

Unistep was developed using Visual Studio 2010.

So... you want to develop ad add-in for Visio...

The development may be performed in two phases:

  • Create the addin-in framework, develop and test it. The result is an add-in that is run by mscorlib.dll, that is, a common Office environment. This is OK for developing purposes, but not for production, as you may see from the following links
  • Add the "shim" that will make this add-in autonomous, so it can be deployed.

Some useful links :

Isolating Microsoft Office Extensions with the COM Shim Wizard

Using a Separate Application Domain to Avoid Crashing

COM Shim Wizards for VS 2010 (Misha Shneerson) . Great article. Also here you can download the Visual studio template to generate the C++ shim  for your project. 

User Interface Extensibility in Visio 2010


Create symbolic links . This is is useful to share among multiple projects in Visual Studio whole folders with source files. No need to li nk individually each file.

Get the strong name public key (sn.exe utility, with Visual Studio). This helps to avoid public references between signed projects.


Create the add-in

The first step is to create a new project, of type "Shared add-in" (Template: Other project type, Shared addin). A wizard is activated. Select Microsoft Visio. The result will be an "add-in" template, with a "connect.cs"  file which contains the GUID of the new add-in and the first class "connect" with the functions that will be called when the add-in is loaded ("onConnection"...).

The class "Connect" will inherit at generation time the interface Extensibility.IDTExtensibility2. IRibbonExtensibility interface is added to be able to manage the Office ribbon. The ribbon will require the Microsoft.Office.Core library.

Connect class inheritance

At this time you may test that the "onConnection"  function is reached when you load the add-in. To load it, I used the method indicated by Misha Schneerson, adding Visio as start project.

In the assembly properties you may enter the GUID, so it will not change when the project is rebuild.

Add-in assembly information

Next step would be to add in the "onConnection" procedure the event.handlers that you will manage.

Visio events

  • "visioAppli" is the Visio object obtained through the "onconnection " call.
  • "visioAppli_documentOpened" is a local procedure that will manage the event.

Depending on your requirements, various events may be taken into account (you see them in Intellisense).

Ribbon management

For the Ribbon I created an XML file containing the groups / buttons description.  This file is added as a file resource pour le project. Here is an example how the buttons "step back" and "step forward" are described in the ribbon.

Ribbon description

You may select the images associated with the controls in Microsoft Office Icons (ImageMSO) Gallery & Extraction.  "cback..;" are calback routines in the "connect" class that perform required actions.

Ribbon callback

These callbacks are entered with the name of the control, so we can choose the action depending on the button.

The Connect class contains also the IRibbonExtensibility members, for example:


Here this procedure gets the Unistep Ribbon (a file declared as resource).

With this framework in place, you are set to develop the required functions. You can test your add-in with the Visual Studio debugger.

Shim development

When you start the Office application, in the add-in list you will see your add-in loaded (well, when it does not crash any more). It will be shown as loaded by "mscorlib.dll".

When it runs OK, it's time to add the shim, to isolate it in production.

You find the "ComshimWizzardSetup.msi" on Misha Schneerson blog. It installs in VS 2010 as a C++ ComShim:

COMShim C++ for VS 2010

When you launch this wizzard, you have to target the original add-in dll (that you generated in the phase 1). The wizzard will generate two projects, ManagedAggregator and "xxxShim" (well, this is the name you choose).

In the final solution you will have to include the two projects generated by this shim : "ManagedAggregator" and the new "xxxShim" as generated.

When you launch the office application, you can check that your add-in is loaded as "xxxshim.dll" and not as mscorlib.dll.

Office (Visio) add in loaded with shim

If this is not the case,  you may find that the add-in was deactivated by office, or not properly loaded. Visual Studio unregisters the old instance and registers the new one, so a rebuild usually solves this situation.


I used the standard no frills installer supplied with  VS 2010,

Debug load problems

When you try to deploy the add-in with the installer on a naked machine, it may not run...  Usually this is due to some missing dll's in the installer.  A very effective debug solution on the target machine is to use the FusLogViewer (fuslogvw.exe)  that shows the dll loaded (and most important the missing ones) in your Office session.

Code signature

To insure  customers, I digitally signed the Unistep deployment modules. I used a certificate bought through Ksoftware from Commodo. The nice extra from Ksoftware is tool  called "ksign" that eases the signature process. It has a command mode that may be activated through the "PostBuildEvent" of the setup process, so the signature is automatic.

Other goodies

To manage in Vs2010 files from other projects, I used a very effective solution:  symbolic folder redirection. This enables create new projects in Visual studio that point to folders with files from other projects. This avoids to copy or set links individually for multiple files in Visual Studio.

For the C++ shim is is useful to sign the project with a strong key (local one).

To limit the publics in projects, the solution I found was to define visible identifiers as internal. In the  projects you may indicate that this internals be visible to other  assemblies:  in the "assemblyInfo.cs" file you add "internalsVisibleTo" line:

Internals visible to another assembly

If you signed the project, you must indicate the public key to activate this visibility. To get the public key (this is not the password that protects your .pfx key!), you may use the sn.exe utility (see link at the top). 

So, I wish you success in developing Office add-ins!

And last, but not least, a big thanks to for the DHTML menu creator used on this site.