Managed add-ins fail or behave unexpectedly after you install a managed COM add-in that includes a custom application configuration file in Office 2003, in Office XP, and in Office 2000

Article translations Article translations
Article ID: 830468 - View products that this article applies to.
This article has been archived. It is offered "as is" and will no longer be updated.
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

Symptoms

In a 2007 Microsoft Office program, in Microsoft Office 2003, in Microsoft Office XP, and in Microsoft Office 2000, managed add-ins fail or behave unexpectedly after you install a managed COM add-in that includes a custom application configuration file.

Cause

This issue may occur when a managed COM add-in overwrites the existing configuration file.

Managed add-ins rely on the common language runtime (CLR) to load the assembly. By default, when the CLR loads the assembly, the CLR searches the path where the host application is installed to locate the configuration file. Therefore, when you deploy an application configuration file for a managed add-in, you typically create the Setup program so that it installs the configuration file to the folder where the host application is installed.

Resolution

To minimize the risk of the configuration file being overwritten, implement one of the following solutions:
  • Use Visual Studio Tools for the Microsoft Office System (VSTO).
  • Use managed smart documents or managed smart tags that are loaded by using the VSTO loader.
  • Use managed smart tags that use a complex C++ smart tag shim.
  • Use managed COM add-ins that use a complex C++ add-in shim.
These solutions force the CLR to search for the configuration file in the installation folder of the managed add-in and to load the configuration file from the installation folder of the managed add-in. Therefore, you can deploy the configuration file to the same folder as the managed add-in. This should prevent the configuration file from being unintentionally overwritten.

More information

Important Microsoft does not currently recommend, and does not support, using application configuration files when you develop and deploy a managed add-in.

Managed solutions that are developed by using VSTO automatically create an AppDomain logical container that contains an AppBase attribute set that references the location where the managed assembly was loaded. This forces the CLR to search for the configuration file in the installation folder of the managed add-in and to load the configuration file from the installation folder of the managed add-in.

By implementing an unmanaged shim, you can create your own AppDomain logical container and AppBase attribute for your managed smart tag solution or managed COM add-in solution.

For more information about the COM Shim Wizard, visit the following Microsoft Developer Network (MSDN) Web site:
http://msdn2.microsoft.com/en-us/library/aa159894(office.11).aspx

References

For more information about how the runtime locates assemblies, visit the following MSDN Web site:
http://msdn2.microsoft.com/en-us/library/yx7xezcf(vs.71).aspx

Properties

Article ID: 830468 - Last Review: January 16, 2015 - Revision: 3.0
Applies to
  • Microsoft Visual Studio .NET 2003 Professional Edition
  • Microsoft Visual Studio .NET 2003 Enterprise Architect
  • Microsoft Visual Studio .NET 2003 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Academic Edition
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Architect
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2002 Academic Edition
  • Microsoft Office Small Business Edition 2003
  • Microsoft Office Access 2003
  • Microsoft Office PowerPoint 2003
  • Microsoft Office Professional Edition 2003
  • Microsoft Office Basic Edition 2003
  • Microsoft Office Access 2007
  • Microsoft Access 2002 Standard Edition
  • Microsoft Office Excel 2007
  • Microsoft Excel 2000 Standard Edition
  • Microsoft Office SharePoint Designer 2007
  • Microsoft FrontPage 2000 Standard Edition
  • Microsoft Office Outlook 2007
  • Microsoft Office Outlook 2003
  • Microsoft Outlook 2000 Standard Edition
  • Microsoft Office PowerPoint 2007
  • Microsoft PowerPoint 2000 Standard Edition
  • Microsoft Office Publisher 2007
  • Microsoft Office Publisher 2003
  • Microsoft Office Word 2007
  • Microsoft Word 2000
  • Microsoft Office 2000 Premium Edition
  • Microsoft Office 2000 Professional Edition
  • Microsoft Office 2000 Standard Edition
  • Microsoft Office 2000 Small Business Edition
  • Microsoft Office 2000 Developer Edition
Keywords: 
kbnosurvey kbarchive kbprb kbprogramming kbaddins kbtshoot KB830468

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com