msbuild: msbuild 17.12 fails to resolve SDKs

Issue Description

After updating to the newest version of Visual Studio on our build servers, build randomly fail due to failure to resolve SDKs.

Error : Could not resolve SDK "Microsoft.NET.Sdk.Web". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK.

This also happens with other SDKs, which are specified in global.json, such as Microsoft.NET.Sdk and Microsoft.Build.NoTargets.

Steps to Reproduce

I can’t provide any samples or logs

Expected Behavior

Builds the same as in 17.10

Actual Behavior

Fails to resolve SDKs

Analysis

The problem started happening immediately after VS 17.12.4 was installed. We did not see this problem in version 17.10.3.

Versions & Configurations

**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.12.4
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

C:\Program Files\Microsoft Visual Studio\2022\professional>msbuild --version
MSBuild version 17.12.12+1cce77968 for .NET Framework
17.12.12.57101
{
  "msbuild-sdks": {
...
    "Microsoft.Build.NoTargets": "3.7.56",
...
    "MSTest.Sdk": "3.7.3"
  },
  "sdk": {
    "version": "8.0.302",
    "rollForward": "latestPatch"
  }
}

Windows Server 2022 (21H2) x64 Intel® Xeon® Gold 6238R CPU @ 2.20GHz, 2195 Mhz, 28 Core(s), 56 Logical Processor(s)

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 44 (42 by maintainers)

Most upvoted comments

So the first step is done: the backport was merged. Now there are some additional steps to let this propagate through the system. I will post updates as they happen.

So, it isn’t just us!

Hi, I’m running into a similar issue and I think it’s caused by this bug as well:

The SDK resolver assembly "C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver\Microsoft.DotNet.MSBuildSdkResolver.dll" could not be loaded. Could not load file or assembly 'Microsoft.DotNet.MSBuildSdkResolver, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

MSBuild version 17.12.12+1cce77968 for .NET Framework

https://github.com/dotnet/msbuild/blob/1cce77968bca1366760f361c837ffbc3a6af70f0/src/Build/BackEnd/Components/SdkResolution/SdkResolverService.cs in that version does not yet include the fix https://github.com/dotnet/msbuild/pull/11079. v17.14.0-preview-25110-01 includes that fix.

@SimaTian can you investigate please and see if that PR could have had this kind of side effect?

##[error]0>C:\cagnt03\_work\15\s\remctrl\CanonWebProxy\Module\CanonWebProxy.Module.csproj(0,0): Error : Could not resolve SDK "Microsoft.NET.Sdk". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK.
           Copying file from "C:\cagnt03\_work\15\b\Release_x64\jprep\Binaries\net8.0\win-x64\Sheela.Simulator\JobModel.ProblemModel.Impl.pdb" to "C:\cagnt03\_work\15\b\Release_x64\jprep\Binaries\net8.0\win-x64\Sheela.Tools.PrismaSyncToCje\JobModel.ProblemModel.Impl.pdb".
0>C:\cagnt03\_work\15\s\remctrl\CanonWebProxy\Module\CanonWebProxy.Module.csproj : error : Could not resolve SDK "Microsoft.NET.Sdk". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK. [C:\cagnt03\_work\15\s\BuildProcessTemplates\Templates\Build\Build.proj]
##[error]remctrl\CanonWebProxy\Module\CanonWebProxy.Module.csproj(0,0): Error : 
           Copying file from "C:\cagnt03\_work\15\b\Release_x64\jprep\Binaries\net8.0\win-x64\Sheela.Simulator\JobModel.Abstractions.pdb" to "C:\cagnt03\_work\15\b\Release_x64\jprep\Binaries\net8.0\win-x64\Sheela.Tools.PrismaSyncToCje\JobModel.Abstractions.pdb".
C:\cagnt03\_work\15\s\remctrl\CanonWebProxy\Module\CanonWebProxy.Module.csproj : error :  [C:\cagnt03\_work\15\s\BuildProcessTemplates\Templates\Build\Build.proj]
       1>Project "C:\cagnt03\_work\15\s\remctrl\remctrl.sln" (1) is building "C:\cagnt03\_work\15\s\remctrl\CanonWebProxy\Module\CanonWebProxy.Module.csproj" (3) on node 7 (default targets).
##[error]3>C:\cagnt03\_work\15\s\remctrl\CanonWebProxy\Module\CanonWebProxy.Module.csproj(0,0): Error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.
3>C:\cagnt03\_work\15\s\remctrl\CanonWebProxy\Module\CanonWebProxy.Module.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found. [C:\cagnt03\_work\15\s\BuildProcessTemplates\Templates\Build\Build.proj]
       3>Done Building Project "C:\cagnt03\_work\15\s\remctrl\CanonWebProxy\Module\CanonWebProxy.Module.csproj" (default targets) -- FAILED.
       1>Project "C:\cagnt03\_work\15\s\remctrl\remctrl.sln" (1) is building "C:\cagnt03\_work\15\s\remctrl\ColoradoAPI2\ColoradoAPI2.ColoradoAPI2.csproj" (4) on node 25 (default targets).
           Copying file from "C:\cagnt03\_work\15\b\Release_x64\jprep\Binaries\net8.0\win-x64\CanonPP.Api.JobLogic\JobModel.IntentModel.Impl.pdb" to "C:\cagnt03\_work\15\b\Release_x64\jprep\Binaries\net8.0\win-x64\Sheela.Tools.PrismaSyncToCje\JobModel.IntentModel.Impl.pdb".
##[error]4>C:\cagnt03\_work\15\s\remctrl\ColoradoAPI2\ColoradoAPI2.ColoradoAPI2.csproj(0,0): Error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.
4>C:\cagnt03\_work\15\s\remctrl\ColoradoAPI2\ColoradoAPI2.ColoradoAPI2.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found. [C:\cagnt03\_work\15\s\BuildProcessTemplates\Templates\Build\Build.proj]
       4>Done Building Project "C:\cagnt03\_work\15\s\remctrl\ColoradoAPI2\ColoradoAPI2.ColoradoAPI2.csproj" (default targets) -- FAILED.