1. To create project template with custom parameter, please flow instruction of blow link

2. I need create classes naming with input value. For one class, it need change at least 3 places. 
For example, The new class base on ClassOldName.cs need named by using custom new value stored in $NewName$,
I  have changed below files:
   1) MyTemplate.vstemplate  
      <ProjectItem ReplaceParameters="true" TargetFileName="Class$NewName$.cs">ClassOldName.cs</ProjectItem>
      <Compile Include="Models\ Class$NewName$.cs " />
namespace $safeprojectname$
    public class Class$WidgetName$
3.  Then build the wizard that implement IWizard with StrongName, and install it to GAC. 
For .net 4.0, the gacUtilit path is  C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\

you need make sure you assembly can be install and uninstall correctly, and get correct PublicKeyToken
add  below in install.bat file, and run as administrator, 

path C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\

gacutil.exe -i CustomWizard.dll
gacutil.exe -u "CustomWizard"
the uninstall code will give result like this:

Assembly: CustomWizard, Version=, Culture=neutral, PublicKeyToken=fbf8d46
e0d2fda8f, processorArchitecture=MSIL
Uninstalled: CustomWizard, Version=, Culture=neutral, PublicKeyToken=fbf8
d46e0d2fda8f, processorArchitecture=MSIL
Number of assemblies uninstalled = 1
Number of failures = 0
Save the publicKeyToken, It will be used that later.

Then re-install the assemble to GAC again. by gacutil -i CustomWizard.dll, it will be ready to use.
to distribute your assembly to other machine, you had better add a setup project for it. in the file system, add "GAC" , then add project output in the GAC install list.

4. last step, add the WizardExtension section on the bottom between </templateContet> and </VSTemplate>

    <!--<Assembly>CustomWizard, Version=, Culture=Neutral, PublicKeyToken=fa3902f409bb6a3b</Assembly>-->
    <Assembly>CustomWizard, Version=, Culture=Neutral, PublicKeyToken=fbf8d46e0d2fda8f</Assembly>
if you didn't use the correct publicKeytoke, and just copy and past the code from the sample code, 
you will got error message when you use the template:
For more information on this problem and how to enable this templateplease see documentation on Customizing Project Templates

My sourcecode of CustomWizard
CustomWizard.rar (1.74 MB)

Comments are closed.