【发布时间】:2019-10-11 17:38:57
【问题描述】:
我的解决方案中有一个面向 .NET Core 2.1 的 ASP.NET Core 项目。我在解决方案级别添加了一个 global.json 文件:
{
"sdk": {
"version": "2.1.400"
}
}
在 Team City 代理上,我安装了 MSBuild Tools 2017 (15.8.1),包括 .NET Core Build Tools。
从命令行我可以看到代理上安装了 SDK 2.1.400:
>dotnet --list-sdks
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.400 [C:\Program Files\dotnet\sdk]
但是,在 Team City 上构建解决方案失败并出现以下错误:
dashboard.csproj : error : Unable to locate the .NET Core SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.
Dashboard.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.
A compatible SDK version for global.json version: [2.1.400] from [X:\agent-1\sandbox1\global.json] was not found
知道为什么在使用 MSBuild 构建时找不到 SDK 2.1.400,因为它存在于 SDK 列表中?
【问题讨论】:
-
您的 Tean City 代理是使用特定用户还是系统帐户运行的?
-
是的,但是,我在该帐户下运行了
dotnet --list-sdks,响应列表为2.1.400。
标签: asp.net-core msbuild