Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Creating Windows Starter Kits for Visual Studio 2005 : Page 3

Microsoft has put renewed energy into its Starter Kits for Visual Studio 2005, but did you know you can create your own Starter Kit and export it to .vsi to share with others? Find out how to build a book search Starter Kit using the Amazon Web service.


advertisement
Open Specific Files When Launching Templates
Recall that the template you've just created has a documentation file. You want this file to be displayed every time someone creates a project using your template. To do so, you need to modify the MyTemplate.vstemplate configuration file located within the LibraryApp Starter Kit.zip file.

First, extract the content of LibraryApp Starter Kit.zip into the default folder—LibraryApp Starter Kit. Then go into the LibraryApp Starter Kit folder and use Notepad to edit the MyTemplate.vstemplate file.

In particular, insert the following line (shown in bold):



<VSTemplate Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project"> <TemplateData> <Name>LibraryApp Starter Kit</Name> <Description><No description available></Description> <ProjectType>VisualBasic</ProjectType> <ProjectSubType> </ProjectSubType> <SortOrder>1000</SortOrder> <CreateNewFolder>true</CreateNewFolder> <DefaultName>LibraryApp Starter Kit</DefaultName> <ProvideDefaultName>true</ProvideDefaultName> <LocationField>Enabled</LocationField> <EnableLocationBrowseButton>true</EnableLocationBrowseButton> <Icon>__TemplateIcon.ico</Icon> </TemplateData> <TemplateContent> <Project TargetFileName="LibraryApp.vbproj" File="LibraryApp.vbproj" ReplaceParameters="true"> <ProjectItem ReplaceParameters="true" TargetFileName="app.config">app.config</ProjectItem> <ProjectItem ReplaceParameters="true" TargetFileName="Documentation.txt">Documentation.txt</ProjectItem>
<ProjectItem ReplaceParameters="false" OpenOrder="10"
OpenInWebBrowser="true">Documentation.txt</ProjectItem>

<ProjectItem ReplaceParameters="true" TargetFileName="Form1.vb">Form1.vb</ProjectItem> <ProjectItem ReplaceParameters="true" TargetFileName="Form1.Designer.vb">Form1.Designer.vb</ProjectItem> ...

Once the MyTemplate.vstemplate file is modified, you need to re-zip everything in the folder back into the LibraryApp Starter Kit.zip file again. You can select all the files in the folder, right-click and then select Send To-->Compressed (zipped) Folder (see Figure 11).


Figure 11. Zipper: Send all of the files into a compression utility to make them portable.
 
Figure 12. Name Change: Rename your .zip file and give it a .vsi file extension.

A .zip file containing all the files in the folder will appear at the bottom of the window. Rename this .zip file LibraryApp Starter Kit.zip and move it out to your My Documents area in a folder called \Visual Studio 2005\My Exported Templates\.

Packaging the Starter Kit using the Visual Studio Installer
Now that the template is created and modified, you need one more step to package it into a Starter Kit. In the folder you just created, create a new file and save it as LibraryApp.vscontent. Populate the LibraryApp.vscontent file with the following:

<VSContent xmlns="http://schemas.microsoft.com/developer/vscontent/2005"> <Content> <FileName>LibraryApp Starter Kit.zip</FileName> <DisplayName>Library Application Starter Kit</DisplayName> <Description>VSTemplate for VB project</Description> <FileContentType>VSTemplate</FileContentType> <ContentVersion>1.0</ContentVersion> <Attributes> <Attribute name="TemplateType" value="Project"></Attribute> <Attribute name="ProjectType" value="Visual Basic"></Attribute> <Attribute name="ProjectSubType" value=""></Attribute> </Attributes> </Content> </VSContent>

In the same folder, create a new empty .zip file (File-->New-->Compressed (zipped) Folder). Drag and drop the LibraryApp Starter Kit.zip and LibraryApp.vscontent files into the newly created .zip file. Rename the .zip file LibraryApp Starter Kit.vsi (see Figure 12).

That's it! The .vsi file is now a Starter Kit.

Installing the Starter Kit
Once the Starter Kit is created, you can distribute it to your fellow developers. A good way to share is to put it on the web for download.

To install the Starter Kit, simply double-click on the .vsi file and the installer will display the dialog shown in Figure 13. Click Next to proceed. You will be warned about security risks of the content you are going to install. Click Yes to proceed. In the final dialog, Click Finish and then Close.


Figure 13. Installing: This dialog will allow you to select the contents to install from the .vsi.
 
Figure 14. My Template: Your new Starter Kit, including documentations, should be located under the My Templates section in Visual Studio.

To verify that the Starter Kit is installed properly, start Visual Studio 2005 and create a new project (File-->New-->Project). You will see the LibraryApp Starter Kit template under the My Templates section (see Figure 14). Select the template and click OK. You will also find that the documentation file is automatically loaded.

You can press F5 to verify that the application works as stated (remember to use your own Amazon subscription ID). You can now proceed to enhance the application to suit your own needs.

In this article, you have seen the steps to create a Starter Kit. Starter Kit is a good way to learn programming and provides a stepping stone to learning best practices from the experts in the industry.



Wei-Meng Lee is a Microsoft MVP and founder of Developer Learning Solutions, a technology company specializing in hands-on training on the latest Microsoft technologies. He is an established developer and trainer specializing in .NET and wireless technologies. Wei-Meng speaks regularly at international conferences and has authored and coauthored numerous books on .NET, XML, and wireless technologies. He writes extensively on topics ranging from .NET to Mac OS X. He is also the author of the .NET Compact Framework Pocket Guide, ASP.NET 2.0: A Developer's Notebook (both from O'Reilly Media, Inc.), and Programming Sudoku (Apress). Here is Wei-Meng's blog.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap