如何在tfs 2017中通过公司代理使用dotnet restore
我可以在我的cmd中运行以下命令: C:\Program Files\dotnet\dotnet.exe还原C:/TFSBuildAgent/\u work/1/s/HelloWorld/HelloWorld.sln 但在tfs中运行时,我得到:如何在tfs 2017中通过公司代理使用dotnet restore,tfs,proxy,nuget,Tfs,Proxy,Nuget,我可以在我的cmd中运行以下命令: C:\Program Files\dotnet\dotnet.exe还原C:/TFSBuildAgent/\u work/1/s/HelloWorld/HelloWorld.sln 但在tfs中运行时,我得到: ****************************************************************************** Starting: Build *******************************
******************************************************************************
Starting: Build
******************************************************************************
Current agent version: '2.112.0'
Agent is running behind proxy server: 'http://correctProxyAddress:correctPort'
******************************************************************************
Starting: Get Sources
******************************************************************************
Prepending Path environment variable with directory containing 'tf.exe'.
Querying workspace information.
tf vc get /version:6 /recursive /overwrite C:\TFSBuildAgent\_work\1\s /loginType:OAuth /login:.,******** /noprompt
All files are up to date.
******************************************************************************
Finishing: Get Sources
******************************************************************************
******************************************************************************
Starting: Run dotnet
******************************************************************************
==============================================================================
Task : Command Line
Description : Run a command line with arguments
Version : 1.1.2
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
==============================================================================
dotnet --info
.NET Command Line Tools (2.0.0)
Product Information:
Version: 2.0.0
Commit SHA-1 hash: cdcd1928c9
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.0.0\
Microsoft .NET Core Shared Framework Host
Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
******************************************************************************
Finishing: Run dotnet
******************************************************************************
******************************************************************************
Starting: dotnet restore
******************************************************************************
==============================================================================
Task : .NET Core (PREVIEW)
Description : Build, test and publish using dotnet core command-line.
Version : 0.3.1
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
==============================================================================
C:\Program Files\dotnet\dotnet.exe restore C:/TFSBuildAgent/_work/1/s/HelloWorld/HelloWorld.sln
Restoring packages for C:\TFSBuildAgent\_work\1\s\HelloWorld\HelloWorld.Test\HelloWorld.Test.csproj...
Restore completed in 12.37 ms for C:\TFSBuildAgent\_work\1\s\HelloWorld\HelloWorld\HelloWorld.csproj.
C:\Program Files\dotnet\sdk\2.0.0\NuGet.targets(102,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\TFSBuildAgent\_work\1\s\HelloWorld\HelloWorld.sln]
C:\Program Files\dotnet\sdk\2.0.0\NuGet.targets(102,5): error : An error occurred while sending the request. [C:\TFSBuildAgent\_work\1\s\HelloWorld\HelloWorld.sln]
C:\Program Files\dotnet\sdk\2.0.0\NuGet.targets(102,5): error : The operation timed out [C:\TFSBuildAgent\_work\1\s\HelloWorld\HelloWorld.sln]
我已将代理设置添加到IIS中TFS的web.config,Nuget.config中,这两个项目中的代理设置都是在此解决方案中构建的,为了更好地衡量,我在中编辑了Nuget配置
C:\Program Files\Microsoft Team Foundation Server 15.0\Tools
我认为这也是它所使用的
Nuget配置:
<configuration>
<config>
<add key="http_proxy" value="http://correctAddress:correctPort" />
<add key="https_proxy" value="http://correctAddress:correctPort" />
</config>
</configuration>
<代码> > p> <代码> c:\程序文件\微软Team Foundation Server 15 \工具< /代码> 此路径是TFS服务器安装的路径。实际上,我在同一路径下的TFS安装路径中找不到nuget.config
文件。只有一个Nuget.exe
命令
此外,构建在构建代理上运行,并使用代理服务器环境include nuget设置。对生成进行排队时,如果未指定nuget.exe
路径,TFS将自动使用代理文件夹中的默认路径,例如…agent\Worker\Tools\nuget.exe
要更改生成代理上相应的nuget.config
文件,您可以尝试更改appdataC:\Users\xxx\appdata\Roaming\nuget\nuget.config
xxx代表您的生成服务帐户下的文件