Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
 How to: Compile Example Code for Pr...
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Visual Studio Automation and Extensibility 
How to: Compile Example Code for Project Model Extensibility 

Most reference topics in the Visual C++ Project Model contain a code example. This code example has been tested to compile using the macro environment and run in the Visual Studio integrated development environment (IDE) while a C++ project is active.

You must add the Microsoft.VisualStudio.VCProjectEngine reference to the macro environment. For more information, see How to: Add or Remove References in Visual Studio.

NoteNote

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. These procedures were developed with the General Development Settings active. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To compile and run a code sample 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.VCProjectEngine to select it, click Add, and click OK.

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

    Imports Microsoft.VisualStudio.VCProjectEngine
  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.

See Project Model Samples for samples of how to instantiate Project Model objects in various Visual Studio languages.

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker