visual studio 2010 - How to prompt user developers for project-specific values when they create a Project from a Custom Template? -
i creating project export project template, using this , this guidance.
these sharepoint 2010 projects created using visual studio 2010.
what have happen user prompted several values (above , beyond solution name) when start new project , select template create. want let them change default names of webpart , user control outset, example.
i getting mixed signals, though, on whether possible. code below here seems indicate user/developer needs add customparameters .vstemplate file, , these values read replace placeholder values. "official" (ms example) code:
<templatecontent> ... <customparameters> <customparameter name="$myparameter1$" value="myvalue1"/> <customparameter name="$myparameter2$" value="myvalue2"/> </customparameters> </templatecontent>
but if that's has done, don't see benefit on putting "todos" in code, , having users/developers global search & replace after opening project.
so i'd "sanity check" in know wheter need do:
is have do:
0) create project 1) export project template 2) alter .vstemplate file, adding code above
?
that seems steps "how to" recommending. main question is, doing prompt user developers of template replacement values (overwriting "myvalue1" , "myvalue2"), or user developers have modify *.vstemplate file add replacement vaues directly? if latter, don't see benefit - locating , altering *.vstemplate file prior creating new project based on template seems far kludgier adding "todo" messages in code replace , value.
iow, user/developer have open *.vstemplate file, replacing both "name"s , "value"s wants, such changing this:
<customparameters> <customparameter name="$title$" value="replace placeholder title"/> <customparameter name="$description$" value="replace placeholder description"/> </customparameters>
...to this:
<customparameters> <customparameter name="$title$" value="a connecticut yankee in king arthur's court"/> <customparameter name="$description$" value="hammerin' hank morgan le fay vincent van gogh fly kite runner"/> </customparameters>
(assuming template saved original developer (me) has added replaceable params in project named "$title$" , "$description$"?
for curious not want export project template see such *.vstemplate file might contain, here pretty generic one, in full:
<vstemplate version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" type="project"> <templatedata> <name>spwftemplate</name> <description>this starting projects create webforms based on existing pdfs</description> <projecttype>csharp</projecttype> <projectsubtype> </projectsubtype> <sortorder>1000</sortorder> <createnewfolder>true</createnewfolder> <defaultname>spwftemplate</defaultname> <providedefaultname>true</providedefaultname> <locationfield>enabled</locationfield> <enablelocationbrowsebutton>true</enablelocationbrowsebutton> <icon>__templateicon.ico</icon> </templatedata> <templatecontent> <project targetfilename="spwftemplate.csproj" file="spwftemplate.csproj" replaceparameters="true"> <folder name="features" targetfoldername="features"> <folder name="feature1" targetfoldername="feature1"> <projectitem replaceparameters="false" targetfilename="feature1.feature">feature1.feature</projectitem> <projectitem replaceparameters="true" targetfilename="feature1.template.xml">feature1.template.xml</projectitem> </folder> </folder> <folder name="package" targetfoldername="package"> <projectitem replaceparameters="false" targetfilename="package.package">package.package</projectitem> <projectitem replaceparameters="true" targetfilename="package.template.xml">package.template.xml</projectitem> </folder> <folder name="properties" targetfoldername="properties"> <projectitem replaceparameters="true" targetfilename="assemblyinfo.cs">assemblyinfo.cs</projectitem> <projectitem replaceparameters="false" targetfilename="key.snk">key.snk</projectitem> </folder> <folder name="spwftemplatevisualwebpart" targetfoldername="spwftemplatevisualwebpart"> <projectitem replaceparameters="true" targetfilename="elements.xml">elements.xml</projectitem> <projectitem replaceparameters="false" targetfilename="sharepointprojectitem.spdata">sharepointprojectitem.spdata</projectitem> <projectitem replaceparameters="true" targetfilename="spwftemplatevisualwebpart.cs">spwftemplatevisualwebpart.cs</projectitem> <projectitem replaceparameters="false" targetfilename="spwftemplatevisualwebpart.webpart">spwftemplatevisualwebpart.webpart</projectitem> <projectitem replaceparameters="true" targetfilename="spwftemplatevisualwebpartusercontrol.ascx">spwftemplatevisualwebpartusercontrol.ascx</projectitem> <projectitem replaceparameters="true" targetfilename="spwftemplatevisualwebpartusercontrol.ascx.cs">spwftemplatevisualwebpartusercontrol.ascx.cs</projectitem> <projectitem replaceparameters="true" targetfilename="spwftemplatevisualwebpartusercontrol.ascx.designer.cs">spwftemplatevisualwebpartusercontrol.ascx.designer.cs</projectitem> </folder> </project> </templatecontent> </vstemplate>
Comments
Post a Comment