Export (0) Print
Expand All

Managed Visual Studio Project Sample

Visual Studio 2005
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

The Managed Visual Studio Project is a sample VSPackage that demonstrates how to use Visual Studio managed package framework (MPF) classes to create and register a Visual Studio project. The default MPF project system, ProjectNode, provides support for the file-based operations of adding and removing files from your project, adding assembly references, editing project properties and node properties, building projects, and starting standard Visual Studio editors for the file items.

NoteNote

Managed Visual Studio Project sample is located in the <VSIP>\EnvSDK\CS_Samples\Project folder.

The following sections explain the steps involved in building and running the managed Project sample.

Security noteSecurity Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices.  Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

To build the managed Project sample

  1. Start Visual Studio. Open the MyProject.sln file within Visual Studio.

  2. On the Build menu, choose Rebuild Solution.

  3. Run the following at the command line to merge command bars and other UI items.

    devenv.exe /setup /rootsuffix exp

  4. The Managed MyProject sample registers itself by invoking the RegPkg tool in a post build event, defined in the Properties dialog box of the MyProject project.

To run the managed project sample

  1. Start Visual Studio using the experimental build by typing the following at the Visual Studio command line:

    devenv.exe /setup /rootsuffix exp

  2. To add or remove files and folders, click on a MyProject to select it in Solution Explorer, and, on the Project menu, click Add New Item or Add Existing Item. This uses the standard Visual Studio dialog boxes to add new and existing items.

  3. To start a standard editor, click on a MyProject file in Solution Explorer to select it and, on the View menu, click Open, Open With, or View Code. This starts one of the standard Visual Studio core editors.

  4. To add an assembly references, click on a MyProject project file in Solution Explorer to select it and, on the Project menu, click Add Reference. This brings up the standard Visual Studio Add Reference dialog box.

  5. To display project properties, click on a MyProject project in Solution Explorer to select it and, on the Project menu, click Properties. This displays the standard Visual Studio Project Properties dialog box.

  6. To build or rebuild, click on a MyProject project in Solution Explorer to select it and, on the Build menu, click Build <solution name> or Rebuild <solution name>. This will build or rebuild the project.

  7. To display project node properties, click on a MyProject file in Solution Explorer to select it and on the View menu, click Properties Window to display a default set of properties in the Properties window.

    To customize these properties, override NodeProperties in your implementation of the ProjectNode class.

The following table lists the important files used when implementing managed Visual Studio project sample.

Source File Description

MyProject.cs

This file provides the basic implementation of the VSPackage and the project. You must create new GUIDs for the classes if you use this file as a template for creating your own project.

PropertyPages.cs

This file provides the implementation of the localized general property page which is accessed by selecting Properties on the Project menu.

Resources.resx

This file provides the localized strings used in the property pages.

Resources.cs

This file contains a standard wrapper for loading the localized strings.

Templates

Project templates are found in the Projects subdirectory. Item templates are found in the ProjectItems subdirectory.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft