问题描述
问题
从TFS 2015构建代理运行时,命令 dotnet build ...
失败,并出现以下错误:
The command dotnet build ...
fails when run from TFS 2015 build agent with the following errors:
C:\ Program Files \ dotnet \ dotnet.exe compile-csc @ {dotnet-compile.rsp的路径)返回了退出代码1
C:\Program Files\dotnet\dotnet.exe compile-csc @(path to dotnet-compile.rsp) returned Exit Code 1
复制步骤
- 使用Visual Studio 2015(工具预览2)创建ASP.NET Core 1.0 Web应用程序.
- 为TFS 2015团队项目提交解决方案.
- 配置以
NT AUTHORITY \ NETWORK SERVICE
(默认)运行的TFS 2015 Windows构建代理. - 使用MSBuild或VSBuild任务触发构建以构建解决方案.
- 构建失败,并出现上述错误.
- Create an ASP.NET Core 1.0 web application with Visual Studio 2015 (Tools Preview 2).
- Commit solution to TFS 2015 team project.
- Configure a TFS 2015 Windows build agent running as
NT AUTHORITY\NETWORK SERVICE
(the default). - Trigger a build using the MSBuild or VSBuild task to build the solution.
- Build fails with the errors above.
环境
- Windows Server 2012 R2
- Team Foundation Server 2015更新2
- Visual Studio 2015社区更新3
- Microsoft .NET Core 1.0.0-SDK预览版2(x64)
- Microsoft .NET Core 1.0.0-VS 2015工具预览2
-
dotnet --version
:1.0.0-preview2-003121 - TFS Build Agent版本:14.95.25122.0
- Windows Server 2012 R2
- Team Foundation Server 2015 Update 2
- Visual Studio 2015 Community Update 3
- Microsoft .NET Core 1.0.0 - SDK Preview 2 (x64)
- Microsoft .NET Core 1.0.0 - VS 2015 Tooling Preview 2
dotnet --version
: 1.0.0-preview2-003121- TFS Build Agent Version: 14.95.25122.0
推荐答案
Visual Studio需要使用分配给构建代理的服务帐户在运行构建代理的计算机上启动一次.
Visual Studio needs to be launched once on the machine running the build agent using the service account assigned to the build agent.
例如,以 NT AUTHORITY \ NETWORK SERVICE
启动Visual Studio:
For example, to launch Visual Studio as NT AUTHORITY\NETWORK SERVICE
:
psexec -i -u "NT AUTHORITY\NETWORK SERVICE" "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe"
(可以在此处下载PsExec.)
(PsExec can be downloaded here.)
可以跳过对Visual Studio Online的登录.
The login to Visual Studio Online can be skipped.
Visual Studio启动后,TFS构建将成功.
After Visual Studio launches, the TFS build will succeed.
编辑1
经过进一步调查,看来您还需要创建一个新的 .NET Core Web应用程序项目( File-> New-> Project ...
)并在Visual Studio启动后对其进行构建.
After further investigation, it appears you also need to create a new .NET Core Web Application project (File -> New -> Project...
) and build it, once Visual Studio starts.
这篇关于从TFS 2015构建代理运行时,VS.NET Core项目的DotNet CLI构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!