简体   繁体   English

如何使用Visual Studio 2017通过Nuget正确发布

[英]How to properly publish with Nuget using Visual Studio 2017

What's the best practice to publish my library with Nuget using VS2017? 使用VS2017与Nuget一起发布我的库的最佳实践是什么? The only target I see is "Folder". 我看到的唯一目标是“文件夹”。 But I want to publish it to some external NuGet feed like MyGet, or self-hosted one. 但我想将其发布到MyGet或自托管的外部NuGet提要。

在此处输入图片说明

According to this answer Nuget CLI in Visual Studio 2017 - How to run? 根据此答案,Visual Studio 2017中的Nuget CLI-如何运行? and Where does Visual Studio keep it's own copy of nuget.exe? Visual Studio在哪里将其保留为nuget.exe的副本? , it seems like I have to download nuget.exe separately and use it either as part of the build script or run it manually with the command line. ,似乎我必须分别下载nuget.exe并将其用作构建脚本的一部分或使用命令行手动运行。

Does it mean there's no way to do this inside Visual Studio using the built-in NuGet package manager? 这是否意味着无法在Visual Studio中使用内置的NuGet程序包管理器来执行此操作?

If so, where should I store nuget.exe, should I add it to my PATH environment variable or store it in my project root under /tools ? 如果是这样,应该将nuget.exe存储在哪里,应该将其添加到PATH环境变量中还是将其存储在项目根目录中的/tools

How to properly publish with Nuget using Visual Studio 2017 如何使用Visual Studio 2017通过Nuget正确发布

If you want to publish your library with nuget to some external NuGet feed, I am afraid you have to download nuget.exe separately and use it either as part of the build script . 如果要使用nuget将库发布到某些外部NuGet提要,恐怕您必须单独下载nuget.exe并将其用作构建脚本的一部分

You could not to do this inside Visual Studio using the built-in NuGet package manager, that because there is no such option we could publish library in Visual Studio. 您无法使用内置的NuGet包管理器在Visual Studio中执行此操作,因为没有这样的选项,我们无法在Visual Studio中发布库。 You can check the Common Commands and Secondary Commands of NuGet package manager in Visual Studio . 您可以在Visual Studio中检查NuGet程序包管理器的“ 常用命令”和“辅助命令”

If so, where should I store nuget.exe, should I add it to my PATH environment variable or store it in my project root under /tools? 如果是这样,应该将nuget.exe存储在哪里,应该将其添加到PATH环境变量中还是应将其存储在/ tools下的项目根目录中?

You can store nuget.exe to your PATH environment variable or store it in your project root under /tools . 您可以将nuget.exe存储到PATH环境变量中,也可以将其存储在项目根目录/tools It depends on whether you need to share your project with others. 这取决于您是否需要与他人共享项目。 According to my experience, if you need share your project to others, I recommend you set nuget.exe under the \\tools folder, so that other users do not need to set environment variables specially on their machine. 根据我的经验,如果需要与其他人共享项目,建议您在\\tools文件夹下设置nuget.exe ,这样其他用户就不需要在他们的计算机上专门设置环境变量。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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