Udostępnij za pośrednictwem


Project Templates for Applications on Application Diagrams

In Application Designer, each application type that supports implementation has a Template property that specifies a default project template. When you implement the application, Visual Studio uses the template to generate the corresponding application project.

The following sections contain more information about project templates for applications on the application diagram:

  • Changing Project Templates

  • Custom Project Templates

For more information, see Introduction to Solutions, Projects, and Items and Application Types and Prototypes for Defining Applications.

Changing Project Templates

Before you implement an application, you can change its project template. When you implement the application, Visual Studio generates the corresponding project files in your solution. For more information, see How to: Change Project Templates for Applications.

Note

The project template affects only the initial creation of the project. You cannot change this template after implementation. Also, you cannot set it for a reverse-engineered application. For more information, see Considerations for Implementing Applications.

For example, for an ASP.NET Web service application, the default project template is an empty Web site. Before implementation, you can select the ASP.NET Web site template instead. This template adds a Web page that you can use to design a user interface as well as a programmatic Web service interface for the Web site. When the application is implemented, an .aspx file for the Web page is added to the application project in Solution Explorer.

Note

Visual Studio does not visualize Web pages on the application diagram. For an implemented ASP.NET application, you can add Web pages to its project through Solution Explorer.

For more information about the different projects available in Visual Studio, see the Visual Studio documentation.

Custom Project Templates

You can assign a custom template to an application instead of using a predefined project template. However, before you can assign a custom template, either the template must first exist or you must create the template. When you implement the application, Visual Studio generates project files as defined by the custom template. For more information, see Visual Studio Templates and Creating Project Templates.

Considerations for Creating and Selecting Custom Templates

When you create or select a custom template, be aware of the following considerations:

  • A custom template should create a project that is consistent with the type of application to which you assign the template.

    Distributed System Designers support only Windows, Office, Web site, and ASP.NET Web application project templates. For example, custom templates that created from Visual Studio Smart Device projects cannot be used for implementing Windows or Office applications.

  • A custom template should generate only a single application project.

  • A custom template might create additional endpoints.

    If you select a project template that includes code for endpoints supported on the application diagram, Visual Studio adds these endpoints to the application on the diagram.

  • A custom template should not generate an application definition (.sdm file). This file will conflict with the one created during the implementation process.

    For example, you can create a custom template from the project of an implemented application. This template will include an .sdm file. However, such templates will generate an error and lock the application diagram. For more information, see Overview of the System Definition Model (SDM) and Troubleshooting Application Diagrams.

    Tip

    To create a template that generates a similar project to an existing implemented application, create a custom prototype from the application. Remove the .sdm file before you save the template. For more information, see How to: Create Custom Prototypes from Configured Applications and Endpoints.

  • When you select a custom template for a custom application prototype that you plan to distribute, set the Template property to a relative path instead of the absolute path and omit the leading backslash (\). This action makes it possible to store the custom template on any drive.

    For example, suppose you choose a custom template located in the directory "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache\...." When you set the template property for the custom application prototype, specify the following relative path instead of the absolute path and omit the leading backslash (\): "ProjectTemplatesCache\...."

See Also

Other Resources

Defining Applications on Application Diagrams

Assigning Project Templates to Applications on Application Diagrams