2
votes

We developed a "Custom Tool" type VSIX Visual Studio Extension in our company. This extension generates C# code from certain xml files. Right now I have a projects which produces the VSIX as the result of the build.

Goal: I would like to also wrap this VSIX into a NuGet package, what my fellow developers can install onto their solution. So I'm searching for some kind of Project Template or something for that. Or it is even good if there's something which triggers the process in the existing project (which now produces the VSIX). I don't seem to find any template for that in Visual Studio (2013).

Bonus chatter: If I'm about to create the NuGet package for a VSIX by hand, how does that go? I'm looking at NuGet Package Explorer. Which files should I add and in what directory hierarchy? I have a VSIX file (which contains the extension.vsixmanifest, the generator dll and a pkgdef). The pkgdef refers to the generator assembly, and also the covered languages. How to construct the NuGet package?

(There's an example for code generator in the Visual Studio SDK: http://code.msdn.microsoft.com/Visual-Studio-2010-SDK-ddfe1372 , see the "SingleFileGenerator" example. Our extension purpose is very different, but architecturally the same: it generates a C# from an xml).

I tried to search the issue, but the hits are talking about very different scenarios, like project template type VSIXs and how to include NuGet packages into VSIXs, etc. Those are off-topic for me. My requirements are less complex in theory.

1
This seems a little odd. Nuget packages are installed into a project; VSIX are installed onto Visual Studio. That said, you probably want to leverage vsixinstaller.exe for this. - Jimmy
It can happen that I'm wrong. Because "Custom Tool" type exteonsion's assemblies needs to be registered with regasm and maybe even gacutil too, NuGet installation capabilities are not enough probably. Our project originally had a vdproj type installer, which is not supported any more after VS 2010. Probably we need to develop a WiX installer, I don't want to go the InstallShield LE way. - Csaba Toth
I still wonder how can I create a NuGet package which when installed installs a VSIX into Visual Studio. Where and how should I place the VSIX file into the NuGet package? - Csaba Toth

1 Answers

2
votes

A while ago I created a package using VSIXCommands which actually did the job. Just refer the VSIXCommand package and change the install.ps inside your package to something like:

param($installPath, $toolsPath, $package, $project)

$id = 'yourPackageId'
$extension = Get-InstalledVsix $id

if(!$extension) {
    Install-GalleryVsix $id
}