COM Shim Wizards v2

Today we release v2 of the COM Shim Wizards. These are updated versions of the wizards we released in 2004 for Visual Studio 2003. The new wizards work with Visual Studio 2005.

There’s a covering article here:

You can download the wizards here:

These wizards allow you to build unmanaged shims for managed Office extensions, including shared add-ins, smart tags and realtime data servers. The wizards will ask you a few simple questions and then generate all the code for the shim, so that you only have to build the shim – you don’t have to write any code.

The reasons why you should use a shim for managed Office add-ins and other extensions are detailed in the article, but essentially they increase robustness by isolating each extension in a separate appdomain. Of course, this functionality is one of the main advantages of using VSTO add-ins over shared add-ins, and is built into the VSTO runtime. Unfortunately, VSTO 2005 provided add-in support only for Outlook 2003. So if you’re targeting any other Office 2003 application, or any earlier version of Office, you had no choice but to use shared add-ins.

The v2 wizards are basically the same as the v1 wizards, although we did take the opportunity to fix a bug and streamline the UI. The only significant difference is that the v2 shims support unloading of the target assemblies.

Until VSTO add-ins provide support for a wider range of Office applications (which it will in the upcoming releases), you are encouraged to provide shims for your add-ins, and these wizards do cover off this requirement quite nicely.

Comments (6)

  1. Guilherme - Brazil says:

    Hi Friends,

    I executed the articles steps, but when I build the wizardShimProject, my shared addin (that was working fine without shim) crashes. Is there something else to do than install the shared addin (from the SetupProject(without shim)) and build the wizardShimProject?

    Images about the solution are there:



  2. Garry Trinder says:

    The COM Shim Wizards generate shims for a range of different Office extension types, including COM add-ins and smart tags. They do not generate shims for automation add-ins. It seems from your screenshots that you are trying to build an automation add-in. See my blog posts here for details on how to extend the COM shim to support automation add-ins:

    From your registry screenshot, it seems that you’re only registering the add-in as a COM add-in. You’re not registering as an automation add-in. See here for details of how to fix that:

    Also, of course, you should be registering the shim, not the managed assembly.

    Also, you don’t say what you’re putting in your setup project. If you’re building and registering a shim, then the shim needs to go into the setup project.

    Finally, you need to provide more specific details of the "crash" you’re experiencing. Even though you are not registering anything correctly, this should not result in a crash – it should merely result in the add-in and/or shim failing to load. Have you debugged your solution? Where is the crash happening? What’s on the stack at the time of the crash?

  3. lakr1 says:

    Shims created for Excel 2002 (XP) does not work, RTD shims for Excel 2003 works fine though.

    I have VS2005 and COM Shim Wizard v2 and Office XP installed, and after debugging the shim the row that seems to fail is in the CLRLoader.cpp:

    IfFailGo( m_pHost->CreateDomainSetup(&pDomainSetupPunk) );

    The HRESULT is something like "The process terminated unexpectedly"

    I also verified that the supplied demo RTD server is sufering from the same issue, so it is no just my own RTD server that fails. The managed DLL’s are working fine, i.e. without the shim.

    Have you verified the RTD shim on different Office versions?

  4. Mat Polutta says:

    Under Outlook, we ran into issues with another application having loaded the CLR (perhaps via mscoree.dll, but who knows), but not having started the CLR.  I changed the LoadCLR method in "CLRLoader.cpp" to invoke the Start() method on m_pHost ICorRuntimeHost object, even when the CorBindToRuntimeEx method returns S_FALSE.  I believe that this would be because the other shim (or mscoree) did not explicitly invoke Start().  Not knowing the details of how Outlook loads the add-ins and Connects to them, it might be best to invoke Start().  When the CLR has not been Started, CreateDomainSetup fails in the CreateLocalAppDomain method.

    Any thought given to using the new Hosting Interfaces, ie. ICLRRuntimeHost instead of ICorRuntimeHost?

  5. Introduction On November 2006, Microsoft released Visual Studio 2005 Tools for the 2007 Office System,

  6. Semil says:

    <a href= >they shall not pass</a> <a href= >cartoons weed pics</a> <a href= >ecuador escorts and threesomes</a> <a href= >illinois i-pass</a>