سؤال

I have created an extension for VS 2010 that deploys a project template. The project template uses a custom wizard (in a specific assembly) that is called when I create a new project based on this template.

I want to package the assembly containing the wizard within the VSIX, so that it gets deployed somewhere the template can find it (I know GAC is not an option with VSIX).

Basically if I deploy the assembly to the GAC, install the VSIX and then create the project the wizard is invoked successfully. If I do the same without deploying the assembly first, the project templates does not find the assembly when I create the project.

My question is: how to deploy a project template and the assembly it needs using a VSIX package?

Thank you for your help

EDIT: I changed the VSIX Sub Path of the wizard assembly reference to "ProjectTemplates" in both the installer project and updated the vsixmanifest content assembly reference accordingly. It seems to work now.

هل كانت مفيدة؟

المحلول

You don't need to get your assembly containing the IWizard implementation in the GAC. You can simply declare it in your extension.vsixmanifest file as an Assembly element in the Content section.

Unfortunately, this doesn't appear to be documented well anywhere.

The only tricky part is making sure that the AssemblyName attribute has the correct value.

نصائح أخرى

I had no luck with the Assembly element technique to work, so in case anyone else runs into the same problem, here's another solution.

Visual Studio looks for wizard DLLs using the BindingPaths registry key. If you add the folder containing your DLL in a subkey of BindingPaths, then Visual Studio will find your DLL.

To do this from a VSIX, create a .pkgdef file in your VSIX project. Set its Include in VSIX property to True, and paste the following text into it:

[$RootKey$\BindingPaths\{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}]
"$PackageFolder$"=""

(where the Xs represent the package GUID, though I suspect any GUID will do).

This works for me:

[$RootKey$\BindingPaths\{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}]
"$PackageFolder$"=""

But assembly element doesn't work.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top