简体   繁体   English

试图击中nuget.org的生成机上的NuGet.exe包

[英]NuGet.exe pack on build machine trying to hit nuget.org

Trying to run NuGet.exe pack on a .csproj with a .nuspec file. 尝试在具有.nuspec文件的.csproj上运行NuGet.exe包。

Everything works fine locally. 本地一切正常。 I've got NuGet.exe checked in alongside the sources. 我已经在源代码旁边签入了NuGet.exe。 This particular NuGet package does not have any dependencies on any other NuGet package listed in the .nuspec file (and even if it did, they would be available in source control). 这个特定的NuGet程序包与.nuspec文件中列出的任何其他NuGet程序包没有任何依赖关系(即使存在,也可以在源代码控制中使用它们)。 I expected for NuGet.exe to just run on the build machine without trying to interact with anything on the web. 我期望NuGet.exe仅在构建计算机上运行,​​而不会尝试与Web上的任何内容进行交互。

There is a NuGet.config file checked into the root folder of the source tree, but the command line commands run on the build machine appear to be ignoring it. 在源树的根文件夹中签入了一个NuGet.config文件,但是在构建计算机上运行的命令行命令似乎忽略了它。 The version appears to be 2.6.40619.9041 (on my local machine, the same nuget.exe that is checked into version control). 版本似乎是2.6.40619.9041(在我的本地计算机上,与版本控制中签入的nuget.exe相同)。

On the build machine, it was initially failing with the "consent" error, below: 在构建计算机上,它最初因“同意”错误而失败,如下所示:

Package restore is disabled by default. To give consent, open the Visual Studio Options dialog, click on Package Manager node and check 'Allow NuGet to download missing packages during build.' You can also give consent by setting the environment variable 'EnableNuGetPackageRestore' to 'true'.

This seemed odd because in this particular example, there are no packages to restore. 这似乎很奇怪,因为在此特定示例中,没有要还原的软件包。 I'm trying to build a package that does not have any other package dependencies. 我正在尝试构建一个没有任何其他软件包依赖项的软件包。 To get past this error, I started running it (in MSBuild Exec task) by forcing the EnableNuGetPackageRestore environment variable, like this: 为了克服此错误,我通过强制EnableNuGetPackageRestore环境变量开始运行它(在MSBuild Exec任务中),如下所示:

Command="(set EnableNuGetPackageRestore=true) & $(NuGetExe) pack $(NuGetSpecFile) $(NuGetPackArgs)"

The next error from the build machine build log, after getting past the consent issue, is this: 克服同意问题后,构建机器构建日志中的下一个错误是:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 168.62.224.25:443

That IP address is the address for nuget.org. 该IP地址是nuget.org的地址。

It appears as though nuget.exe is trying to do something like auto-update itself or some other task. 似乎nuget.exe尝试执行自动更新本身或其他任务之类的操作。

Q1: Is there any way to disable this behavior? Q1:有什么办法可以禁用此行为? If it is the auto-update, can I prevent this with some sort of command line option. 如果是自动更新,可以使用某种命令行选项来防止这种情况。

Q2: Although the nuget docs site lists -ConfigFile as a valid parameter for "nuget pack" it won't accept it. Q2:尽管nuget docs站点将-ConfigFile列为“ nuget pack”的有效参数,但它不会接受。 Is that parameter supposed to work? 该参数应该起作用吗?

Q3: If all else fails, how do I get NuGet.exe to look at our internal ProGet server (to which it could have access) instead of trying to look at nuget.org (to which access is blocked)? 问题3:如果所有其他方法均失败,我如何获取NuGet.exe来查看我们的内部ProGet服务器(它可以访问的内部服务器),而不是尝试查看nuget.org(被阻止的访问)?

Umm, I had checked in the NuGet.exe "bootstrapper" instead of the actual program. 嗯,我已经检查了NuGet.exe的“ bootstrapper”,而不是实际的程序。

Once I checked in the version found at %LOCALAPPDATA%\\NuGet it stopped trying to reach out to the web. 一旦我签入%LOCALAPPDATA%\\ NuGet中找到的版本,它便停止尝试访问网络。

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

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