没有NuGet的NuGet软件包还原同意 [英] NuGet package restore consent without NuGet

查看:118
本文介绍了没有NuGet的NuGet软件包还原同意的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近使用NuGet向我们的项目中添加了一些依赖项.为了使二进制文件不受版本控制系统的影响,我启用了软件包还原功能,并将生成的.nuget文件夹添加到了存储库中.同样,具有依赖项的项目将RestorePackages选项设置为true,并在.nuget文件夹中为nuget.targets设置了Import -tag.

We recently added a few dependencies to our project using NuGet. To keep the binaries out of the version control system, I enabled the package restore feature and added the resulting .nuget folder to the repository. Also the project with the dependencies got the RestorePackages option set to true, and an Import-tag for the nuget.targets within the .nuget folder.

因此,在安装了NuGet并在VS设置中启用了软件包还原功能的所有机器上,它们都可以正常运行.但是,当我想使用此设置在其他计算机上安装依赖项时,会遇到一些问题.

So that all works well on my machine with NuGet installed and the package restore feature enabled in my VS settings. However when I want to use this setup to install the dependencies on other machines I run into a few problems.

给我的印象是,包含nuget.exe的一个优点是允许我在不一定安装了NuGet的计算机上使用它.但是,在阅读同意的文章之后,我认为原因是真正失败的原因是那些机器没有在其设置中启用程序包还原功能–显然,因为它们在技术上甚至都不了解NuGet.

I was under the impression that one advantage of including the nuget.exe would allow me to use this on machines that do not necessarily have NuGet installed. However, after reading the article on consent I think the reason it actually fails is that those machines do not have the package restore feature enabled in their settings – obviously as they technically do not even know about NuGet.

在未安装NuGet的计算机上启用软件包还原的首选方法是什么?除了构建服务器以外,没有安装NuGet实际上不是有效选项吗?

What is the preferred way to enable package restore on machines that do not have NuGet installed? Is not having NuGet installed actually a valid option other than for build servers?

或者理想情况下,如果未自行安装NuGet且用户无法设置此设置,是否有办法默认从解决方案中启用程序包还原? (我实际上可以想到一个创建NuGet.Config%AppData&\NuGet的安装脚本)

Or ideally, is there a way to enable package restore by default from the solution if NuGet isn’t installed itself and as such the setting could not be set by the user? (I actually could think of a setup-script that creates a NuGet.Config to %AppData&\NuGet)

推荐答案

尝试一下:

Install-Package NuGetEnablePackageRestore

或检查程序包的内容(将其解压缩),您会在其中找到一些有趣的东西这将对您有所帮助(例如,可以通过MSBuild设置环境变量).登录NuGet后,您可以在浏览器中下载软件包.

Or check the contents of the package (unzip it), you'll find some interesting stuff there that will help you out (e.g. there's a way to set an environment variable from within MSBuild). You can download the package within the browser after logging into NuGet.

这篇关于没有NuGet的NuGet软件包还原同意的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆