Skip to content

SDK resolution failing after image update #51525

@Youssef1313

Description

@Youssef1313

Issue Description

In microsoft/testfx, we are seeing:

Test method Microsoft.Testing.Platform.Acceptance.IntegrationTests.MSBuildTests_Test.RunUsingTestTargetWithNetfxMSBuild threw exception:
System.InvalidOperationException: Non-zero exit code 1 from command line: '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe" D:\a_work\1\s\artifacts\tmp\Release\testsuite\msLAI\MSBuildTests /t:Restore'
STD: MSBuild version 17.14.19+164abd434 for .NET Framework
Build started 11/3/2025 2:35:16 AM.
D:\a_work\1\s\artifacts\tmp\Release\testsuite\msLAI\MSBuildTests\MSBuild Tests.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.
D:\a_work\1\s\artifacts\tmp\Release\testsuite\msLAI\MSBuildTests\MSBuild Tests.csproj : error :   Unable to locate the .NET SDK. Check that it is installed, your PATH is configured for the correct architecture, and that the version specified in global.json (if any) matches the installed version.
D:\a_work\1\s\artifacts\tmp\Release\testsuite\msLAI\MSBuildTests\MSBuild Tests.csproj : error :   The NuGetSdkResolver did not resolve this SDK because there was no version specified in the project or global.json.
D:\a_work\1\s\artifacts\tmp\Release\testsuite\msLAI\MSBuildTests\MSBuild Tests.csproj : error :   MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.NET.Sdk" because directory "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\Sdk" did not exist.
Project "D:\a_work\1\s\artifacts\tmp\Release\testsuite\msLAI\MSBuildTests\MSBuild Tests.csproj" on node 1 (Restore target(s)).
D:\a_work\1\s\artifacts\tmp\Release\testsuite\msLAI\MSBuildTests\MSBuild Tests.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.
Done Building Project "D:\a_work\1\s\artifacts\tmp\Release\testsuite\msLAI\MSBuildTests\MSBuild Tests.csproj" (Restore target(s)) -- FAILED.
Build FAILED.
D:\a_work\1\s\artifacts\tmp\Release\testsuite\msLAI\MSBuildTests\MSBuild Tests.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.
D:\a_work\1\s\artifacts\tmp\Release\testsuite\msLAI\MSBuildTests\MSBuild Tests.csproj : error :   Unable to locate the .NET SDK. Check that it is installed, your PATH is configured for the correct architecture, and that the version specified in global.json (if any) matches the installed version.
D:\a_work\1\s\artifacts\tmp\Release\testsuite\msLAI\MSBuildTests\MSBuild Tests.csproj : error :   The NuGetSdkResolver did not resolve this SDK because there was no version specified in the project or global.json.
D:\a_work\1\s\artifacts\tmp\Release\testsuite\msLAI\MSBuildTests\MSBuild Tests.csproj : error :   MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.NET.Sdk" because directory "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\Sdk" did not exist.
"D:\a_work\1\s\artifacts\tmp\Release\testsuite\msLAI\MSBuildTests\MSBuild Tests.csproj" (Restore target) (1) ->
D:\a_work\1\s\artifacts\tmp\Release\testsuite\msLAI\MSBuildTests\MSBuild Tests.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.
0 Warning(s)
2 Error(s)
Time Elapsed 00:00:00.74
ERR: No .NET SDKs were found.
Download a .NET SDK:
https://aka.ms/dotnet/download
Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-found

Last known working image details:

Image: windows.vs2022preview.amd64.open
Image Version: 2025.1016.010057

First known broken image details:

Image: windows.vs2022preview.amd64.open
Image Version: 2025.1101.033625

It seems the first image uses a preview VS while the second image uses a stable VS. I'm guessing with stable VS it's not able to resolve RC2?

I'm not sure though why it's only one specific test failing where we call MSBuild directly by locating it via vswhere.

Steps to Reproduce

Navigate to microsoft/testfx CI and see failure there. Probably clone it in a similar environment to try to repro locally :)

It should be reproducible on current main: https://github.com/microsoft/testfx/tree/649aaa53aed43c64f270f6ae77624c062812dc51

Expected Behavior

Maybe works? or at least a better error suggesting how to fix?

Actual Behavior

Doesn't work

Analysis

No response

Versions & Configurations

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    untriagedRequest triage from a team member

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions