Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable To Reference Wizard Assembly in VSIX Deployed Template

I am trying to create a VISX extension for Visual Studio 2010 that contains a few project templates. These templates aren't very complex, but I want to expose some additional configuration for them during creation via a wizard. I have successfully set up my VISX package to deploy the templates to the directory structure I want in VS2010, but as soon as I try to configure and run a wizard, I receive an error when I create the template along the lines of:

Error: this template attempted to load component assembly 'My.Assembly, Version 1.0.0.0, Culture=neutral, PublicKeyToken=...

My current configuration is as follows:

  • All the projects live in the same solution.
  • The VISX project includes project references to the project containing the wizards and to each template.
  • Each template is built from a project template template (...confusing terminology).
  • They are added through the .vsixmanifest designer as content, referencing the projects.
  • Each .vstemplate file has a WizardExtension element pointing to the IWizard implementation and containing assembly.
  • The wizard assembly is signed.

The .vstemplate files point to their wizards like this:

<WizardExtension>

<Assembly>My.Assembly, Version=1.0.0.1, Culture=neutral, PublicKeyToken=a494da9e6e53f845, Custom=null </Assembly>

<FullClassName>My.Assembly.Wizard</FullClassName>

</WizardExtension>

This, as far as I can tell, is how I'm supposed to do it. What exactly is going wrong? It looks like it can't find the assembly. Are there any other steps I need to take in order to get the assembly visible to the templates? The assembly is deployed to the extension folder when it is installed (I verified this), so it is at least making it out. Is there something special I need to do to the .vstemplate files to tell them to look in the extensions folder vs the GAC? Did I just miss something?

Note that I have found several pages on the internet stating that I have to GAC the assembly manually or with a script. However, few had my exact scenario (Project template templates being referenced by a VISX project, most examples are using a regular project exported via the project template wizard and having their packages dumped into the VISX folder structure). The only one I found that matched my scenario was an example from Microsoft. I tried to match that, but alas it still does not work. I tried relocating the project I downloaded to reference in this question but I cannot find it again, though.

Using scripts is how we've done this before, but I want to try and make things a little cleaner using VISX packages. I would like to avoid this, but if it's mandatory to script the VISX to install the template to GAC, I can do that.

like image 965
Bill Nadeau Avatar asked Jun 22 '12 19:06

Bill Nadeau


People also ask

What is wizard and template?

You can use wizards to create memos, letters, faxes, and many other business documents. The major difference between a wizard and a template is that a wizard walks you through text entry for many parts of a document, whereas a template simply displays placeholder text that you replace on your own.


1 Answers

When deploy the wizard based project template by VSIX Extension, it is better to use Short-Named assembly in .vstemplate. This can avoid the GAC deployment.

In your case, it should be:

<WizardExtension>
 <Assembly>My.Assembly</Assembly>
 <FullClassName>My.Assembly.Wizard</FullClassName>
</WizardExtension>
like image 129
Ethan Wu Avatar answered Nov 15 '22 11:11

Ethan Wu