如何使用公司代理在tfs 2017中使用dotnet还原

时间:2017-09-05 09:36:13

标签: tfs proxy nuget tfs2017

我可以在我的cmd中运行以下命令:

C:\ Program Files \ dotnet \ dotnet.exe restore C:/TFSBuildAgent/_work/1/s/HelloWorld/HelloWorld.sln

但是当在tfs中运行时,我得到:

val df = sqlcontext.sql(" SELECT *, DATEDIFF(hour,DOB,"+GETDATE()+")/8766 AS AgeYearsIntTrunc")

我已将代理设置添加到IIS中的TFS的web.config,Nuget.config中的两个项目中的代理设置正在此解决方案中构建,以便编辑

中的nuget配置
******************************************************************************
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]

我认为它也是它使用的那个!

Nuget configs:

C:\Program Files\Microsoft Team Foundation Server 15.0\Tools

1 个答案:

答案 0 :(得分:1)

C:\Program Files\Microsoft Team Foundation Server 15.0\Tools此路径是TFS Sever安装路径。实际上我在同一路径下的TFS安装路径中找不到nuget.config文件。只有Nuget.exe命令。

除了构建在构建代理上运行并使用代理服务器环境包括nuget设置。对构建进行排队时,如果尚未指定nuget.exe路径,TFS将自动使用代理文件夹中的默认路径,例如... agent \ Worker \ Tools \ Nuget.exe

enter image description here

要更改构建代理上的相应nuget.config文件,您可以尝试更改appdata下的文件C:\Users\xxx\AppData\Roaming\NuGet\NuGet.config xxx代表构建服务帐户