Skip to content

Do MSBuild versions use different LangVersions when using <LangVersion>latest</LangVersion>? #8243

Discussion options

You must be logged in to vote

Yes, sort of, for now.

This is an artifact of some details of how Visual Studio and the .NET SDK are each packaged and how they interact.

When have a global.json locking you to an SDK version and use .NET SDK (dotnet build/dotnet run) to build, every part of the build toolchain uses that version--you get the MSBuild that's packaged in that SDK, the SDK tasks and targets from that SDK, and the Roslyn tasks and targets from that SDK.

In Visual Studio/MSBuild.exe, it's not the same--you always get the MSBuild that is packaged with Visual Studio, import the SDK tasks and targets from the SDK mentioned in global.json, and get Roslyn tasks and targets from Visual Studio.

This can be quite confu…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jaredpar
Comment options

Answer selected by GangWang01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #8242 on December 14, 2022 15:05.