gpt4 book ai didi

visual-studio-2013 - Nuget.exe : An existing connection was forcibly closed by the remote host

转载 作者:行者123 更新时间:2023-12-04 18:04:17 29 4
gpt4 key购买 nike

在我的预构建脚本中的构建服务器上,我想获取解决方案所需的所有包。

为什么?因为会发生这种情况:

This project references NuGet package(s) that are missing on this computer.
Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.
The missing file is ..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets.

根据 Nuget documentation包恢复应该作为 TFS 2013 构建的一部分发生 - 但很明显它不会。

我试图将此实现为预构建操作(自定义脚本执行)。每当我尝试在构建服务器上运行 nuget 时,都会发生这种情况:

PS D:\ws\more\txs04\Data\Services\MyProject\.nuget> .\nuget.exe
An existing connection was forcibly closed by the remote host

显然是代理问题。不幸的是,我没有找到任何解决方案。我以构建用户身份登录并更改了代理设置。我还尝试了环境变量 - 以及 nuget 配置选项。但是,由于我什至无法调用 nuget.exe config,所以这不是一种选择。

编辑: 我可以在我的开发机器(通常运行 nuget 的机器)上重现此行为。 runas/user:dev\tfsbuild powershell 接下来我尝试执行 nuget.exe 并发生上述错误。但是,如果我使用 tfsbuild 用户登录,则不会发生这种情况。

最佳答案

我在从构建 .proj 文件中的目标运行 nuget restore 命令时遇到了类似的问题。

 <Target Name="RestorePackages">
<Exec Command="&quot;$(ToolsHome)NuGet\NuGet.exe&quot; restore &quot;$(SourceHome)SolutionFile.sln&quot;" />
</Target>

我添加了两个附加参数,为我解决了这个问题: -非交互式 -需要同意

<Target Name="RestorePackages">
<Exec Command="&quot;$(ToolsHome)NuGet\NuGet.exe&quot; restore &quot;$(SourceHome)SolutionFile.sln&quot; -NonInteractive -RequireConsent " />
</Target>

希望这对遇到此问题的其他人有所帮助。

关于visual-studio-2013 - Nuget.exe : An existing connection was forcibly closed by the remote host,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29848315/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com