IT:AD:Visual Studio:HowTo:Create a Starter Kit

  • Clone the Solution you want to turn into a StarterKit
  • Open the Solution
  • Edit/Strip out superfluous/Add notes, etc. until the project is in the right shape to Export.
  • Replace Parameters (See: http://msdn.microsoft.com/en-us/library/eehb4faa.aspx).
    • Built in:
      • clrversion
      • GUID1 (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.
      • 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 applies only to item templates.
      • 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.
      • SpecificSolutionName: The name of the solution. When “create solution directory” is checked, SpecificSolutionName has the solution name. When “create solution directory” is not checked, SpecificSolutionName is blank.
      • 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.
      • Define them:

<TemplateContent>
...
  <CustomParameters>
    <CustomParameter Name="$color1$" Value="Red"/>
    <CustomParameter Name="$color2$" Value="Blue "/>
  </CustomParameters>
...
</TemplateContent>

    * `$developing company$`
    * `$copyrightyear$`
    * `namespace $safeprojectname$`

* In the .vstemplate file for the template, locate the ProjectItem element for each file (!). * Set the ReplaceParameters attribute to true for the ProjectItem element. For example:

You can also use the the Parameters to modify the contents of files:

  <ProjectItem ReplaceParameters="true">Class1.cs</ProjectItem>

Note that you can also use the the Parameters to rename files:

<TemplateContent>
      ...
    <ProjectItem
        ReplaceParameters="true"
        TargetFileName="$projectname$.exe">
            File1.exe
    </ProjectItem>
      ...
</TemplateContent>

  • On the File menu, click Export Template. The Export Template wizard opens.
  • Click Project Template.
    • If you have more than one project in your current solution, select the projects you want to export to a template.
  • Click Next, and select an icon and a preview image for your template. These will appear in the New Project dialog box.
  • Enter a template name and description, and click Finish.
  • Your project is exported into a .zip file and placed in the specified output location, and, if selected, imported into Visual Studio.
  • If you have the Visual Studio SDK installed, you can wrap the finished template in a .vsix file for deployment by using the VSIX Project template. For more information, see Creating Extensions By Using the VSIX Project Template.
  • /home/skysigal/public_html/data/pages/it/ad/visual_studio/howto/create_a_starter_kit.txt
  • Last modified: 2023/11/04 02:00
  • by 127.0.0.1