I would like to create a custom item template that includes a wizard (IWizard interface).
On http://msdn.microsoft.com/en-us/library/vstudio/ms171411%28v=vs.100%29.aspx and some other places it is always described that the assembly containing the wizard has to be installed in GAC. I would like to distribute my template in my organisation, and not everybody has right to install anything into GAC.
So I'm wondering, is there no way to have the assembly containing the wizard code inside the template zip, or vsix file?
It seems to me that this should be a common problem?
Any help how to distribute a custom wizard and item template without any GAC installations?
After a lot of research, I found a way to do that. With this method it is possible to include the assembly with the IWizard implementation into the VSIX file, even without signing it, and having it available at runtime. No need to fiddle with the GAC.
You need 3 projects in your solution
Inside MyWizardImpl you need to implement the IWizard interface, in an arbitray class. (we call it MyWizardImpl.ItemTemplateWizard1). When compiling this, you get as output
<solutiondir>\MyWizardImpl\bin\Debug\MyWizardImpl.dll
Now, in MyTemplate\MyTemplate.vstemplate, you need to reference it
<WizardExtension>
<Assembly>MyWizardImpl</Assembly>
<FullClassName>MyWizardImpl.ItemTemplateWizard1</FullClassName>
</WizardExtension>
The tricky part comes last: Including the assembly inside the vsix in a way that it can be loaded when the ItemTemplate is applied.
Example:
<Content>
<Assembly AssemblyName="MyWizardImpl">Assemblies\MyWizardImpl.dll</Assembly>
</Content>
Build and test the solution, the wizard code should run now when using the template.
If you need more than one template in your vsix, you simply need to add additional ItemTemplate projects. All the wizards can go into the same MyWizardImpl assembly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With