Deploy assembly containing IWizard for project template with VSIX
Asked Answered
Z

3

13

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.

Zomba answered 23/2, 2011 at 11:28 Comment(1)
I found one more useful answer [here][1] [1]: #16244685Gallice
S
16

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.

Speculum answered 24/2, 2011 at 0:22 Comment(3)
Thank you, I have udpated the content tag according to the page you provided. The GUI for the vsixmanifest had generated a strange reference, something like |AssemblyName|. But the project template still does not find the assembly. How do I tell it where to find the assembly?Zomba
Could you please update your question with some more details? Exactly which files did you change, and how? Thanks.Weeden
@I33t Maybe have a look at #16244685Singular
G
4

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).

Godlike answered 2/11, 2011 at 3:4 Comment(2)
@Godlike how to create .pkgdef file ? have you used any tool? because in add new item i'm not getting option for .pkgdef fileBron
I have created a simple .pkgdef file added given [$RootKey but it is not working as expectedBron
O
2

This works for me:

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

But assembly element doesn't work.

Oaf answered 17/7, 2012 at 12:11 Comment(1)
i failed to create .pkgdef file , is there any utility , I have directly created a file with same extention and added above line into that as it is but I failed to create a project using this VSIX same error appears :( can you help meBron

© 2022 - 2024 — McMap. All rights reserved.