Project Templates for Applications on Application Diagrams
In Application Designer, an application that supports implementation has a template property that specifies the project template used to generate the corresponding project when the application is implemented. Each application type specifies a default project template, which can be changed. For more information, see Introduction to Solutions, Projects, and Items and Application Types and Prototypes for Defining Applications.
The following sections contain more information about project templates for applications on the application diagram:
Changing Project Templates
Custom Project Templates
Changing Project Templates
Prior to implementation, you can change the project template. When the application is implemented, Visual Studio uses the template to generate the corresponding project files in the solution. For more information, see How to: Change Project Templates for Applications.
Note
The project template affects only the initial creation of an application's project and cannot be changed once the application is implemented or set if an application is reverse-engineered. 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. Prior to implementation, you can choose to use 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
Web pages are not visualized on the application diagram. For an implemented ASP.NET application, you can add also 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
Instead of using a predefined project template, you can assign a custom template to an application. 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 Choosing Custom Templates
When creating or choosing custom templates, 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.
Only Windows, Office, and Web site project templates are supported. For example, custom templates created from Visual Studio Smart Device projects cannot be used for implementing Windows or Office applications.
A custom template should only generate a single application project.
A custom template might create additional endpoints.
If you choose a project template that includes code for endpoints supported on the application diagram, these endpoints are added to the application on the diagram.
A custom template should not generate an application definition (.sdm file), which will conflict with the one created during the implementation process.
For example, creating a template from a project associated with an implemented application includes an .sdm file in the template. 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 saving the template. For more information, see How to: Create Custom Prototypes from Configured Applications and Endpoints.
When choosing a custom template for a custom application prototype that you plan to distribute, set the template property to a relative path from the "Microsoft Visual Studio\8\Common7\IDE\" directory, without the leading backslash (\), instead of the absolute path.
This makes it possible for the custom template to be stored on any drive. For example, suppose a custom template is stored in the directory "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplatesCache\...." When you set the template property, 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