Create a Visual Studio Project template

Source: Internet
Author: User

Install MVC, Asp. net Ajax, some new project templates will appear in the new project list. After creating a project through these project templates, we will make some configuration required for these projects, or you can simply create some sample projects, which simplifies a lot of configuration work and has some learning wizard functions. In many cases, we may also need to create such a project template by ourselves. In fact, the procedure is very simple. Here we will use a simple example to describe how to create a project template, and create an installation file.

Creating a project template is very simple. You only need to export the project that you want to use as the project template. in Visual Studio, find: File> export Template

If there are multiple projects in the current solution, we may select the project to be used as the template through the drop-down box, and select "Project template" to go to the next step:

Here, you can choose whether to automatically import the template to Visual Studio, or whether to display the exported Project template. Click Finish to export the project template, it will be automatically imported to Visual Studio for us, and the exported Project template directory will pop up. It is a zip compressed file. In this case, open Visual Studio and use the exported template when creating a new project.

So far, the project template has been created. However, it is not convenient to manually copy the compressed file to the Project template directory every time we install the template. We hope that the installation can be completed by double-clicking the installation file without the need to copy the file manually. At this time, we need a file,. vscontent, to create the. VSI Installation File. We have created an XML file named sampleprojecttemplate. vscontent In the exported Project template directory. Its content is as follows:

<? XML version = "1.0" encoding = "UTF-8"?>
<Vscontent xmlns = "http://schemas.microsoft.com/developer/vscontent/2005">
<Content>
<FILENAME> sampleprojecttemplate.zip </FILENAME>
<Displayname> sample project template </displayname>
<Description> A project template created for this example. </description>
<Filecontenttype> vstemplate </filecontenttype>
<Contentversion> 1.0 </contentversion>
<Attributes>
<Attribute name = "projecttype" value = "Visual C #"/>
<Attribute name = "projectsubtype" value = "Web"/>
<Attribute name = "templatetype" value = "project"/>
</Attributes>
</Content>
</Vscontent>

The above attribute configuration is not described much. It should be noted that the projectsubtype attribute specifies to install the template in the web project list. Compress the compressed Project template file and sampleprojecttemplate. vscontent into oneZipFile, and modify the suffix:. VSI.Then you can see what changes have taken place on its icon. Double-click the file and we will get the following installation wizard interface:

OK. This is a required project template installation file. You can directly install and import the project template.

now, you can start to create your own project template and enjoy the convenience of the Project template :).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.