Sunday, July 06, 2008

Update Default Visual Studio 2008 Project Templates

To update existing Visual Studio project templates, follow the manual instructions here. Should you wish to change the default templates, they can be found at:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates

I wanted to set TreatWarningsAsErrors to true by default for all class library projects. First precaution, I took a backup copy of the original zip file prior to unzipping the files.
Next step, the line below was added to the to the debug and release PropertyGroup sections of the extracted csproj file.


Then, I recompressed all the extracted files and copied the zip back to the ProjectTemplates directory, overwriting the original zip.
Finally, it is necessary to regenerate the templates as Visual Studio seems to load them from:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache

To regenerate the default templates, run devenv.exe /installvstemplates from a Visual Studio command prompt.