使用MsBuild和NuGet构建TeamCity:“无法连接到远程服务器" [英] TeamCity building with MsBuild and NuGet: "Unable to connect to the remote server"

查看:93
本文介绍了使用MsBuild和NuGet构建TeamCity:“无法连接到远程服务器"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了TeamCity以使用MsBuild构建一个NuGet打包的项目. 在构建过程中,发出了以下安装软件包的命令,但失败:

I have setup my TeamCity to build using MsBuild a project that NuGet packages. During the build, the following command to install packages is issued, but fails:

..\nuget.exe install "C:\TeamCity\buildAgent\work\811b6866c8757c46\Service\packages.config" -source "https://nuget.org/api/v2/" -RequireConsent -solutionDir "..\ "
错误:
Unable to connect to the remote server 退出代码为1.

..\nuget.exe install "C:\TeamCity\buildAgent\work\811b6866c8757c46\Service\packages.config" -source "https://nuget.org/api/v2/" -RequireConsent -solutionDir "..\ "
Error:
Unable to connect to the remote server with exit code 1.

有趣的是要注意的是,当我在cmd提示符下(相同路径内)运行此完全相同的命令时,它成功执行而没有任何错误.

Interesting to note is that when I run this exact same command on the cmd prompt (inside the same path), it succeeds without any errors.

这是我到目前为止所做的:

This is what I have done so far:

  • 在TeamCity中的环境变量下添加一个新的构建参数:env.EnableNuGetPackageRestore并将其设置为'true'
  • 添加到包源的特定路径( https://nuget.org/api/v2/)放在..nuget \ nuget.targets文件中(如此处所述)
  • 提供附加路径以提供路径的方法:
  • 修改了.nuget文件夹(..nuget \ nuget.config)内的nuget.config文件
  • 修改了构建运行器正在(C:\ Windows \ SysWOW64 \ config \ systemprofile \ AppData \ Roaming \ NuGet \ nuget.Config)下执行的SYSTEM帐户的nuget.config(如
  • Add a new Build Parameter under environment variables in TeamCity: env.EnableNuGetPackageRestore and set it to 'true'
  • Add a specific path to the package sources (https://nuget.org/api/v2/) inside the ..nuget\nuget.targets file (as described here)
  • To provide the additinal paths ways to supply a path:
  • Modified the nuget.config file inside the .nuget folder (..nuget\nuget.config)
  • Modified the nuget.config for the SYSTEM account that the build runner is executing under (C:\Windows\SysWOW64\config\systemprofile\AppData\Roaming\NuGet\nuget.Config) (as described here)

我在想的是,这与系统用户的漫游配置文件(与构建代理一起运行)有关,因为当构建代理与我的帐户一起运行时,所有配置都可以使用.但是两个配置文件的nuget.config是相同的,我没有主意.也许系统用户无法在WinServer2012R2上访问Internet?也许它需要其他权限?哪一个?

What I was thinking is that this has something to do with a roaming profile of the System user (that the build agents runs with) because it all works when build agent runs with my account. But the nuget.config is the same for both profiles, and I'm out of ideas. Maybe the System user doesn't have access to the Internet on WinServer2012R2? Maybe it needs additional permissions? Which ones?

您对尝试什么有任何想法吗?

Do you have any ideas of what to try?

推荐答案

该错误原来是我们在网络上拥有ISA服务器(TMG客户端)的设置.默认情况下,这不是为新的(本地)用户设置的,因此SYSTEM帐户无法访问网络.

The error turned out to be the setting for the ISA server we have on our network (the TMG client). By default this isn't set up for new (local) users and therefore the SYSTEM account didn't have access to the web.

我已经为新的本地用户(非域,密码未过期)设置了此功能,并将其添加到Administrators组中,现在可以正常使用了.

I've set this up for a new local user (non-domain, with password that doesn't expire), added it to Administrators group and now it works just fine.

这篇关于使用MsBuild和NuGet构建TeamCity:“无法连接到远程服务器"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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