I get an error that the template files are not found.
I use these syntaxes for the GetProjectTemplate() call:
MyTemplatePath = soln.GetProjectTemplate("My own template.zip","");
MyTemplatePath = soln.GetProjectTemplate("My own template.zip","Visual
C#");
MyTemplatePath = soln.GetProjectTemplate("My own
template.zip","CSharp");
None of them work. Please SOS !!!
dave@incdev.com - 31 May 2006 10:11 GMT
> I get an error that the template files are not found.
>
[quoted text clipped - 7 lines]
>
> None of them work. Please SOS !!!
Well, this works but there may be a better way....
I'm assuming you want to call AddFromTemplate.
guess what - if you dont put your template in a zip file (or expand the
zip file you got when you exported the project you used to make the
template)
and pass the file name of the .vstemplatefile as the first parameter -
it works.
e.g. <path to your expandedtemplate>\<your template>.vstemplate
you can sort of make GetProjectTemplate to work... If you
put your template in the
My Documents\Visual Studio 2005\Templates\ProjectTemplates\Visual C#
directory
use it by hand to make a new project from Fle New project in the visual
studio menus, close the new solution BUT NOT visual studio.
If you then run your wizard in the same ide GetProjectTemplate will
work - but look at the return value - it's for the .vstemplate file and
the path is a temp cache directory that Visual Studio has expanded the
template into - the .zip bit in the path is NOT a zip file but a
directory.
Oh. and the docs are misleading - you can just refer to the .csproj
file in AddFromTemplate and it still works and better yet it does
return a reference to the project instead of NULL. (wont run any fancy
replacements though)