从TFS 2015构建代理运行时,VS.NET Core项目的DotNet CLI构建失败 [英] DotNet CLI build fails for VS .NET Core project when run from TFS 2015 build agent

查看:41
本文介绍了从TFS 2015构建代理运行时,VS.NET Core项目的DotNet CLI构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题

从TFS 2015构建代理运行时,命令 dotnet build ... 失败,并出现以下错误:

The command dotnet build ... fails when run from TFS 2015 build agent with the following errors:

C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ DotNet \ Microsoft.DotNet.Common.Targets(262,5):错误:对象引用未设置为对象的实例.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(262,5): Error : Object reference not set to an instance of an object.

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


复制步骤

  1. 使用Visual Studio 2015(工具预览2)创建ASP.NET Core 1.0 Web应用程序.
  2. 为TFS 2015团队项目提交解决方案.
  3. 配置以 NT AUTHORITY \ NETWORK SERVICE (默认)运行的TFS 2015 Windows构建代理.
  4. 使用MSBuild或VSBuild任务触发构建以构建解决方案.
  5. 构建失败,并出现上述错误.
  1. Create an ASP.NET Core 1.0 web application with Visual Studio 2015 (Tools Preview 2).
  2. Commit solution to TFS 2015 team project.
  3. Configure a TFS 2015 Windows build agent running as NT AUTHORITY\NETWORK SERVICE (the default).
  4. Trigger a build using the MSBuild or VSBuild task to build the solution.
  5. 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构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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