Skip to content

Installing Build Tools for Visual Studio messes up the MSBuild path #61275

@changov

Description

@changov

Version

24.12.0

Platform

Microsoft Windows NT 10.0.20348.0 x64

Subsystem

No response

What steps will reproduce the bug?

[not a core node.js issue, bit I figured it's worth sharing at least as a caveat and to help others recover]

I installed via the Windows MSI, which worked great by itself. But I also chose the option to install the VS Build Tools for C++, and that ended up messing up my system. The symptom was that attempting to do a .Net build in a 64-bit terminal would fail with:

The NuGetSdkResolver did not resolve this SDK because there was no version specified in the project or global.json

I didn't save the whole output, but the key hint from the remaining message was that it was looked for the .Net SDK under "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Sdks\Microsoft.NET.Sdk\Sdk", and I don't have such a path.
It turned out that the Build Tools for Visual Studio 2022 installer had put a bunch of x86 paths at the front of the system PATH, including "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64", and that resulted in either the wrong build of msbuild.exe running (in spite of that "amd64" at the end of the path) or wrong base path to search for SDKs.

Resolved by uninstalling the Build Tools for Visual Studio 2022.

How often does it reproduce? Is there a required condition?

Select the option to install the Build Tools for Visual Studio

What is the expected behavior? Why is that the expected behavior?

.

What do you see instead?

Broken .Net SDK resolving

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions