views:

400

answers:

1

I am trying to add a new project template for an often used pattern. Starting from the class library template I have done the following (it still does not show up in the new project window):

  1. opened the .vstemplate file
  2. changed name and description to 'hard coded' values (my template). The values in there pulled from the csharpui.dll resources.
  3. changed the TemplateID, DefaultName, and ProjectItems included.
  4. saved these to the ProjectemplatesCache folder and as a zip in the ProjectTemplates folder.
  5. restarted VS2010 and checked the new project location which should have shown my new template.

specifically, the folders I saved to were.. C:\program files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache\CSharp\Windows\1033\HostComm.zip (the zip is the folder name, not a zip file) and C:\program files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Windows\1033 (this folder has a HostComm.zip file in it)

Has anyone else done this? Can it be done? If it can then what did I miss?

+2  A: 

Doing this by hand is pretty courageous. Having a folder name with an extension .zip sounds wrong, I don't see a similar one in the existing templates. Watch out for the shell's habit of turning .zip archives into folders.

Best thing to do is to use the documented procedure to create a project template and verify what effects it has so you can repro them accurately yourself. Create a new project, using one of the existing templates as a starter. You might as well make it look as close as possible to the ultimate template you want to end up with, add project items as desired.

Then use File + Export Template. Next. Fill in the text boxes, note the Output location. Finish. Have a look-see at the generated .zip file.

Hans Passant
I didn't really want to do it by hand. I wasn't aware of the Export Template feature. Obviously I should have poked around in the UI a bit more. Thanks for the answer.
gbogumil