Поделиться через


Namespace Considerations in Office Solutions

You cannot change the default namespace (or root namespace in Visual Basic) of an Office project after you create the project. The default namespace will always match the project name you specified when you created the project. If you rename your project, the default namespace does not change. For more information about the default namespace in projects, see Application Page, Project Designer (C#) and Application Page, Project Designer (Visual Basic).

Applies to: The information in this topic applies to document-level projects and application-level projects for Microsoft Office 2010 and the 2007 Microsoft Office system. For more information, see Features Available by Office Application and Project Type.

Changing the Namespace of Host Item Classes in C# Projects

Host item classes (for example, the ThisAddIn, ThisWorkbook, or ThisDocument classes) have their own namespaces in Visual C# Office projects. By default, the namespace for host items in your project matches the project name you specified when you created the project.

To change the namespace of the host items in a Visual C# Office project, use the Namespace for Host Item property. For more information, see Properties in Office Projects.

See Also

Concepts

Document Host Item

Workbook Host Item

Properties in Office Projects

Other Resources

Programming Application-Level Add-Ins

Designing and Creating Office Solutions