NuGet Package which installs a VSIX

一笑奈何 提交于 2019-12-22 01:15:01

问题


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:


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
}


来源:https://stackoverflow.com/questions/21119829/nuget-package-which-installs-a-vsix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!