RSS

Tag Archives: vs template

Visual Studio Template Parameters

When creating a single Visual Studio template (or multiple), the following parameters are available:

Parameter Description
clrversion Current version of the common language runtime (CLR).
GUID [1-10] A GUID used to replace the project GUID in a project file. You can specify up to 10 unique GUIDs (for example, guid1).
itemname The name provided by the user in the Add New Item dialog box.
machinename The current computer name (for example, Computer01).
projectname The name provided by the user in the New Project dialog box.
registeredorganization The registry key value from HKLM\Software\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization.
rootnamespace The root namespace of the current project. This parameter is used to replace the namespace only in an item being added to a project.
safeitemname The name provided by the user in the Add New Item dialog box, with all unsafe characters and spaces removed.
safeprojectname The name provided by the user in the New Project dialog box, with all unsafe characters and spaces removed.
time The current time in the format DD/MM/YYYY 00:00:00.
userdomain The current user domain.
username The current user name.
webnamespace The name of the current Web site. This parameter is used in the Web form template to guarantee unique class names. If the Web site is at the root directory of the Web server, this template parameter resolves to the root directory of the Web Server.
year The current year in the format YYYY.

Source: MSDN

Advertisements
 
Leave a comment

Posted by on July 3, 2012 in References

 

Tags: ,

Visual Studio Multiple Projects Template

To create a Visual Studio project template that include multiple projects, create a new .vstemplate file:

<VSTemplate Version="2.0.0" Type="ProjectGroup"
    xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
    <TemplateData>
        <Name>Acme Web Project</Name>
        <Description>A project template to create Acme Web.</Description>
        <Icon>Icon.ico</Icon>
        <ProjectType>VisualBasic</ProjectType>
    </TemplateData>
    <TemplateContent>
        <ProjectCollection>
            <ProjectTemplateLink ProjectName="Acme.Web">
                Acme.Web\MyTemplate.vstemplate
            </ProjectTemplateLink>
            <ProjectTemplateLink ProjectName="Acme.Common">
                Acme.Common\MyTemplate.vstemplate
            </ProjectTemplateLink>
        </ProjectCollection>
    </TemplateContent>
</VSTemplate>

Place the file in a folder containing all project template folders. In this case, “Acme.Web” and “Acme.Common” templates.

Source: MSDN

 
1 Comment

Posted by on July 3, 2012 in General

 

Tags: ,

NuGet Packages in Visual Studio Project Template as New Project

When include NuGet packages in Visual Studio project template, a modification will need to be done if the template will be used as new project.

Modify .vstemplate file:

<VSTemplate>
        <packages repository="template">
            ...
        </packages>
    </WizardData>
</VSTemplate>

Notice repository attribute in <packages> node.

All the .nupkg files must be placed in the root directory of project template zip file.

 
3 Comments

Posted by on July 3, 2012 in General

 

Tags: , ,

Include NuGet Packages in Visual Studio Project Template

In a single Visual Studio project template, you can include NuGet packages so that when project is added, the NuGet packages are pre-installed.

A small modification is necessary if you are going to use this to create new project.

Edit .vstemplate file to include:

<VSTemplate>
    <WizardExtension>
        <Assembly>NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
        <FullClassName>NuGet.VisualStudio.TemplateWizard</FullClassName>
    </WizardExtension>
    <WizardData>
        <packages>
            <package id="jQuery" version="1.6.2" />
        </packages>
    </WizardData>
</VSTemplate>

Where <packages> will include all packages pre-installed to the Visual Studio template.

Source: NuGet Docs

 
1 Comment

Posted by on July 3, 2012 in General

 

Tags: , ,

 
%d bloggers like this: