April 18, 2011, 5:21 a.m.
posted by para
Shimming: A Solution to the Problems with MsCoree.dll
Despite the gloomy picture painted for COM add-ins being loaded by mscoree.dll, a solution resolves these three problems. The solution involves writing a custom CLR host DLL called a shim DLL (written in C++) to be the loader for the CLR and the COM add-in instead of relying on mscoree.dll. A new shim DLL must be created for each COM add-in you are going to deploy. Using a shim DLL leads to a number of advantages:
If you are building a managed COM add-in for Outlook 2003, consider using the new VSTO Outlook Add-in project. Building an add-in in this way resolves the problems with mscoree.dll as well as some other Outlook-specific issues with add-ins described in Chapter 24.
Microsoft has provided a Visual Studio COM add-in shim wizard project that works with Visual Studio 2003. It is available at http://msdn.microsoft.com/office/default.aspx?pull=/library/enus/dno2k3ta/html/ODC_Office_COM_Shim_Wizards.asp. At the time this book was written, no wizards were available for Visual Studio 2005. However, you can use the C++ COM shim project generated by this wizard in Visual Studio 2003 and import it into Visual Studio 2005.