Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

HOW TO: Change the Assembly Name or the Assembly Namespace for Your Office Managed Code Extension


View products that this article applies to.

Summary

This step-by-step article describes how to change the name of an assembly or how to change the namespace of an assembly for a managed code extension that you create with Microsoft Visual Studio Tools for the Microsoft Office System.

To change the name for your assembly or the namespace for your assembly, you must modify properties in the Office project and then rebuild the assembly.

If you instead try to modify the assembly name in Microsoft Windows Explorer by renaming the assembly file, or if you do not change the Office Integration attribute after you change the Root Namespace property in the project, you may receive the following error message when the managed code extension is loaded in Microsoft Word or in Microsoft Excel:
The assembly <assembly name> could not be found at .\<assembly location>\ or could not be loaded. You can still edit and save the document. Contact your administrator or the author of this document for further assistance.


To correctly change the assembly name or the assembly namespace for your managed code extension, follow these steps:

Change the Name of an Assembly

  1. Start Visual Studio .NET 2003, and then open your Office project.
  2. On the View menu, click Solution Explorer.
  3. In Solution Explorer, right-click your project, and then click Properties.
  4. In the Common Properties list, click General.
  5. Type the new name for your assembly in the Assembly Name box, and then click OK.
  6. On the Build menu, click Build Solution.

Change the Namespace of an Assembly

  1. Start Visual Studio .NET 2003, and then open your Office project.
  2. On the View menu, click Solution Explorer.
  3. In Solution Explorer, right-click your project, and then click Properties.
  4. In the Common Properties list, click General.
  5. Type the new namespace for your assembly in the Root Namespace box, and then click OK.
  6. Locate the Assembly: System.ComponentModel.DescriptionAttribute attribute in your ThisWorkbook code module or in your ThisDocument code module.

    This is the Office Integration attribute.
  7. Modify the Office Integration attribute to reflect the new namespace.

    For example, if you named your namespace MyNamespace, the Office Integration attribute appears in the code module as follows:
    <Assembly: System.ComponentModel.DescriptionAttribute( _
       "OfficeStartupClass, Version=1.0, Class=MyNamespace.OfficeCodeBehind")>
  8. On the Build menu, click Build Solution.

↑ Back to the top


References

For additional information about how to grant permissions to folders and to assemblies and about how to troubleshoot in Office at runtime, see the documentation for Visual Studio Tools for the Microsoft Office System.

↑ Back to the top


Keywords: KB824003, kbhowtomaster, kbpia

↑ Back to the top

Article Info
Article ID : 824003
Revision : 6
Created on : 2/3/2006
Published on : 2/3/2006
Exists online : False
Views : 422