How to: Add Application-Level Smart Tags to Projects That Were Created Before SP1

Applies to

The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Application-level projects

  • Excel 2007

  • Word 2007

For more information, see Features Available by Application and Project Type.

When you create an application-level add-in project after you install Visual Studio 2008 Service Pack 1 (SP1), the project automatically includes infrastructure code that enables you to create application-level smart tags in your project. If you want to use a project that you created before you installed SP1, you must modify the project to generate this code.

For more information about application-level smart tags, see Smart Tags Overview.

To modify the project so that it generates the required code

  1. Ensure that the project is not open in Visual Studio.

  2. Locate the project directory, for example by using Windows Explorer.

  3. In the project folder, delete the ThisAddIn.Designer.cs or ThisAddIn.Designer.vb file.

    This code file contains infrastructure code that configures the add-in when it is loaded. Normally, this code file is hidden from view in Solution Explorer.

  4. Open the ThisAddIn.Designer.xml file in a text editor.

  5. Add the following XML element as a child of the hostitem:hostItem element.

    <hostitem:hostControl hostitem:name="VstoSmartTags" hostitem:identifier="VstoSmartTags"
     hostitem:type="Microsoft.Office.Tools.SmartTagCollection" 
     hostitem:primaryCookie="VstoSmartTags" hostitem:modifier="Internal" />
    
  6. Save and close the ThisAddIn.Designer.xml file.

  7. Open the project in Visual Studio.

    Visual Studio automatically regenerates the ThisAddIn.Designer.cs or ThisAddIn.Designer.vb file, and adds the VstoSmartTags field to the ThisAddIn class. This is the field that you use to create application-level smart tags.

  8. Add a reference to one of the following assemblies, depending on the project type:

    • For a Word project, add a reference to Microsoft.Office.Tools.Word.v9.0.dll.

    • For an Excel project, add a reference to Microsoft.Office.Tools.Excel.v9.0.dll.

    These assemblies contain the classes you use to create smart tags.

When you are done, you can follow the instructions in one of the following topics to create an application-level smart tag:

See Also

Concepts

Smart Tags Overview

Smart Tags Architecture

Change History

Date

History

Reason

July 2008

Added topic.

SP1 feature change.