This documentation is archived and is not being maintained.

Walkthrough: Adding Building Blocks to the Template

Visual Studio .NET 2003

If you want to support the ability to add additional language projects of the types contained within the complex prototype created in Walkthrough: Creating a New Enterprise Template (for example to add another working WebService project), you need to provide the connections to hook everything together. This requires a change to your directory structure, some edits in one .vsdir file, and creation of another one.

To allow additional building blocks (in this case, the types of projects allowed)

  1. In Windows Explorer, navigate to ..\EnterpriseFrameworks\ProxyProjects and select the ProxyProjects folder.
  2. On the File menu, select New, then click Folder. This creates a subfolder within the ProxyProjects folder. Rename this folder UserComponents.

    You now need to create a file that contains the information to be displayed in the Add New Project dialog box.

  3. Open the UserComponents folder, and then create a file called UserComponents.vsdir. Copy the following lines and paste them into it.
    ..\..\Projects\MyTemplate\BackendProjects\WebService\WebService.csproj|{AE77B8D0-6BDC-11d2-B354-0000F81F0C06}|WebService|10|An example of a language project building block|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4547|0|WebService
    ..\..\Projects\MyTemplate\UIProjects\WinApp\WinApp.csproj|{AE77B8D0-6BDC-11d2-B354-0000F81F0C06}|WinApp|10|An example of a language project building block|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4547|0|WinApp
    ..\..\Projects\MyTemplate\UtilityProjects\UtilityLibrary\UtilityLibrary.csproj|{AE77B8D0-6BDC-11d2-B354-0000F81F0C06}|UtilityLibrary|10|An example of a language project building block|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4547|0|UtilityLibrary

These three lines point to the language projects contained within the template hierarchy.

Next, inform the Visual Studio Add New Project dialog box that the new subfolder named UserComponents must be displayed.

To inform the Add New Project dialog box of the new subfolder

  1. Open ProxyProjects.vsdir, located in the ProxyProjects folder. Add the following line:
  2. Save and close ProxyProjects.vsdir.

This allows the icons to display in the Add New Project dialog box, under the UserComponents folder.

When pointing to the components you have already defined, you should note that ELEMENT identification is already finished because you did it earlier (see "Applying Policy Using ELEMENTSET Nodes" in Walkthrough: Creating a New Enterprise Template). If you decide to define a new building block that has not been previously identified, you must add a corresponding ELEMENT definition and provide policy on the new ELEMENT, using INCLUDE or EXCLUDE tags to determine whether it is appropriate to each ELEMENTSET.

To check the results of the preceding changes

  1. Close Visual Studio, restart it, and open your project.
  2. Right-click the Solution node, select Add, and click New Project to display the Add New Project dialog box. Expand the Enterprise Template Projects folder and notice the new prototypes available in the UserComponents folder. Click Cancel to close the dialog box.
  3. Repeat the process, selecting each of the nodes in Solution Explorer to see the effects of the policy you specified above. The changes made to the applicable ELEMENTSET nodes in our policy file determine which project icons display when any particular node is selected.

If you want to add building blocks that are not part of your standard template (optional components, for example), you can use the same mechanism just described. Simply create another folder beneath the Projects folder (C:\Program Files\Microsoft Visual Studio .NET 2003\EnterpriseFrameworks\Projects) containing the prototype, and follow the same procedure.

See Also

Walkthrough: Creating a Template Using Subproject Wizards | Walkthrough: Creating a New Enterprise Template | Custom Template Walkthroughs | Policy Walkthroughs with TDL Files