我想使用的MSBuild命令行建立一个解决方案,我不断收到此错误:MSBUILD抛出错误:SDK“Microsoft.NET.Sdk”指定找不到
error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.
的msbuild的版本是Microsoft Visual Studio 2017工具的最新版本。我正在使用Windows Server 2012 R2,并且该项目使用.NET Core 2.0。
这是我使用的命令:
msbuild.exe /p:Configuration=Release /t:restore C:\Projects\MyProject.sln
完善的日志:
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 9/16/2017 3:09:03 PM.
Project "C:\Projects\MyProject.sln" on node 1 (restore target(s)).
ValidateSolutionConfiguration:
Building solution configuration "Release|Any CPU".
Project "C:\Projects\MyProject.sln" (1) is building "C:\Projects\Kernel\Kernel.csproj" (2) on node 1 (restore target(s)).
C:\Projects\MyProject.sln" (1) is building "C:\Projects\Kernel\Kernel.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.
Done Building Project "C:\Projects\MyProject.sln" (1) is building "C:\Projects\Kernel\Kernel.csproj" (restore target(s)) -- FAILED.
Build FAILED.
"C:\Projects\MyProject.sln" (restore target) (1) ->
"C:\Projects\Kernel\Kernel.csproj" (restore target) (2) ->
C:\Projects\Kernel\Kernel.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.
0 Warning(s)
11 Error(s)
我的猜测是该项目引用该SDK。为了构建它,它必须被安装。编译器如何才能打印和其他所有内容? – Christopher
@Christopher我用完整的日志编辑了帖子。是的,我的项目引用该SDK,但我试图恢复它。 –
按照我的想法。编译器找不到SDK。您需要将它安装到编译器中进行构建。理想情况下,你选择了默认位置。如果没有,您可能需要编辑该项目,以便在适当的位置查找SDK。 – Christopher