Visual Studio Template : Beyond the basics

The Microsoft documentation in msdn is both complete and lacking.

There is enough detail available to resolve most problems. However the examples are so poor that it can be hard to find out about why you would use them.

For example:

$year$ = this is expanded into the year. This is very useful for compyright headers.

They are also incomplete.

Templates in VS 2005 allow developers to easily replace or add to the items that are available when you select new item.

Templates are zip files containing:

  • .vstemplate
  • one or more custom files.

By customising these you can save a lot of cut-and-paste time and effort.

This page of Template parameters is not complete.

$safeitemrootname$ = This appears to be the name that the user enters into the dialog.

If you combine this with multi-item templates as defined here. This allows you to use the supplied name as a root of a class. For example you could have a template that takes a name such as Entity.cs that creates the following files:

  • EntityModel.cs
  • IEntityModel.cs
  • IEntityView.cs
  • IEntityController.cs
  • EntityController.cs

$fileinputname$ = This also work in the template

$XmlConvert_itemname$ = what does this do? I think this is a wizard populated item.

It appears that the WizardExtension appears to work in item templates too despite the documentation.

I will investigate this and will post about it.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s