Skip to content

Known Issue: .NET 10.0.100-rc.2 can fail to launch the C# compiler when used in Visual Studio 2022 #12669

@rainersigwald

Description

@rainersigwald

In some circumstances, building a project using Visual Studio 2022 and .NET SDK 10.0.100-rc.2 can produce an error like

D:\a\_work\1\s\.dotnet\sdk\10.0.100-rc.2.25502.107\Roslyn\Microsoft.CSharp.Core.targets(84,5): error : You must install or update .NET to run this application.

Details

The C# compiler (csc.exe or vbcscompiler.exe) in .NET SDK 10.0.100-rc.2 and higher runs a .NET 10 process using an apphost. In Visual Studio 2026, MSBuild and the .NET SDK will work together to ensure that the runtime that application attempts to run in matches the SDK.

That functionality is not implemented in MSBuild 17.14, though, so using Visual Studio 2022 with the RC2 SDK can hit build-time errors locating the correct runtime.

This is known to happen when a repo is configured to use a repo-local SDK with a paths entry in global.json.

.NET SDK 10.0.100 requires Visual Studio 2026 to target .NET 10.

Workaround

While targeting .NET 10 is not supported in 17.14, teams that are hitting this should be able to temporarily work around the issue by setting DOTNET_HOST_PATH to a repo-local install of a .NET 10 dotnet.exe - essentially mimicking the behavior of the .NET 10 Sdk Resolver. For the 10 GA release, we will have a build-time warning that calls out this incompatibility directly.

Note

Ideally this would be done only when building in 17.14 environments - setting this environment variable in an 18.0+ environment will currently override the behavior of the .NET 10 SdkResolver - we are planning on changing this to make the SdkResolver take precedence in #12655.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Visual StudioIssues related to interactions with Visual Studio or project systems.triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions