How do I create a pure solution-level NuGet package

℡╲_俬逩灬. 提交于 2019-12-09 16:17:50

问题


I want to create and distribute a NuGet package that when installed only installs solution-wide to the root packages-folder, referencing the package in the .NuGet\packages.config file.

I have found some information on the NuGet package format in regards to this topic already and according to NuGet FAQ this should be possible if one follow these guidelines:

What is the difference between a project-level package and a solution-level package?

A solution-level package has to be installed only once in a solution to be available for all projects in the solution. A project-level package must be installed separately in each project where you want to use it. For solution-level packages, NuGet doesn't change anything in a project, whereas in a project-level package it does. Typically, a solution-level package installs new commands that can be called from within the Package Manager Console window.

Another Suggested SO solution states that the above should have worked too.

Thing is, I can't get it this to work. I have verified that my package has no lib or content directories:

I have put all the files to distribute in the tools-folder in the package, including the init.ps1` script top run on install.

I am using Visual Studio 2015 and when I want to install the package:

  1. I first of all have to select a project to install to. I had expected not having to specify this, as it is supposed to be solution-wide. :/
  2. The init.ps1 script does run and executes the commands as I want them to do. :)
  3. But, a packages-folder is created in the project that I was forced to choose to get the installation done. I would have expected the packages-folder to be created in the solution-root. :(
  4. Also, the packages.config file is created in the project-folder and not in .NuGet\packages.config, as I'd expect after reading the docs I have found on this. :(

Any suggestions on how to get this working? Is this a VS 2015 limitation or a NuGet 3 change (as I believe it was included in VS2015)?


回答1:


The NuGet team deprecated solution level packages in NuGet 3.0.

There is a discussion about bringing them back in a way that is compatible with Visual Studio 2013 for a future version of NuGet.



来源:https://stackoverflow.com/questions/33352258/how-do-i-create-a-pure-solution-level-nuget-package

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