Share via


Visual Studio Project Creation Wizard and Templates

I found an interesting feature when creating a Visual Studio project template. (Details about how to create a template is left to a forthcoming post.) I was working on a wizard for the project template.

In the IWizard::RunStarted method for the wizard, when you add items to the replacementsDictionary parameter, Visual Studio seems to take the values and substitute them into the template files. This is not surprising since this is what it is advertised to do. What is interesting is the difference in how the variables are named.

 For example, when referring to the project name in a template file, you would use the construct $safeprojectname$. However, let's say you have something in a template file such as "myVariableName". If you add an entry in the replacementsDictionary with a key named myVariableName with value someVariable, then the fragment "myVariableName" in the template file is turned into "someVariable". This is different from the other construct's. Which is interesting since I am not sure if this is documented anywhere.