简体   繁体   中英

Publishing Nuget Packages with multiple VSIX using NuGet Package Explorer Tool

I have a number of VSIXs for a product of mine that I would like to distribute as a Single Nuget package. There are 3 separate Visual Studio 2013 packages that I only wish to distribute to VS 2013 IDE's (won't run in earlier versions of VS).

I have registered on Nuget and I have downloaded the NuGet Package Explorer where I entered in all the meta data for my package.

I added a VSIX folder to my Package contents called VSIX and added my three VSIX extensions.

I published the package and although I am able to search and run my NuGet package from within Visual Studio, it does not seem to run the VSIX extensions.

I notice when I click on any of my vsix files within NuGet Package Explorer it says that * The format of this file is not supported. *

How do I deploy my extensions via Nuget packages?

Any assistance would be awesome!

Cheers

You need to put you VSIX-files into 'tools' folder of your package. Then you have to create init.ps1 or install.ps1 to kick the installation process of vsix. Please note that install.ps1 will not be called for 'solution wide packages' (ie packages which have no content or lib folder). So if your package has only 'tools' folder you'll have to put installation logic into init.ps1. But init.ps1 will be called every time you open your solution in VS. This is a breaking change NuGet team made in NuGet 2.6 or 2.7 (I don't remember exacly). So now putting installation login into init.ps1 isn't a good idea anymore :(

Installation script could look like this:

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

if (-not $toolsPath) { throw "toolsPath parameter wasn't specified" }

if ($dte.Version -eq "10.0") {
    $vsixFileName = "MyExtensiion.vs2010.vsix"
} elseif ($dte.Version -eq "11.0") {
    $vsixFileName = "MyExtensiion.vs2012.vsix"
} else {
    $vsixFileName = "MyExtensiion.vs2013.vsix"
}

$vsxInstaller = [System.IO.Path]::Combine($toolsPath, $vsixFileName)
Start-Process -FilePath $vsxInstaller 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM