How to: Compile Example Code for Visual C++ Code Model Extensibility

In Visual Studio 2013, add-ins are deprecated. We recommend that you upgrade your add-ins to VSPackage extensions. For more information about how to upgrade, see How to: Convert an Add-in to a VSPackage.

Most reference topics in the Visual C++ Code Model Extensibility reference contain a code example. This code example has been tested to compile in the Macro environment and run in the Visual Studio development environment while a C++ project is active.

Note Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Customizing Development Settings.

To compile and run a code example with the macro editor

  1. On the View menu, point to Other Windows and then click Macro Explorer.

  2. Expand MyMacros.

  3. Right-click Module1 and click Edit on the shortcut menu.

    This opens the Visual Studios Macros environment.

  4. Right-click the References folder and click Add Reference on the shortcut menu.

  5. In the Add Reference dialog box, click Microsoft.VisualStudio.VCCodeModel to select it, click Add, and click OK.

  6. Add the following code to the top of the module file:

    Imports Microsoft.VisualStudio.VCCodeModel
  7. Add the sample code from the reference topic to the module file.

  8. Right-click MyMacros and click Build on the shortcut menu.

  9. Close the Visual Studios Macros environment.

  10. On the Tools menu, point to Macros, and then click Macro Explorer.

  11. Right-click the procedure name (from Module1) and click Run from the shortcut menu.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft