-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
I have a net6.0 console application with LangVersion set to latest. The code I am running is the one from this issue. My project also has the following global.json:
{
"sdk": {
"version": "6.0.100",
"rollForward": "latestFeature"
}
}
I noticed a strange behaviour when running my console application via command line and using Visual Studio 17.4.1. dotnet run will use MSBuild 17.0, while VS 17.4 uses MSBuild 17.4, which is perfectly normal.
The problem is that the code from the bug I linked will have a different output when the LangVersion is set to 10.0 compared to 11.0. When I run the build from 17.0 I get the output expected from C#10, but when I run the build from 17.4 I get the output expected from C#11.
I then added a build target to print $(NETCoreSDKVersion) and $(MaxSupportedLangVersion), but both builds print 6.0.111 and 10.0.
My question is if different MSBuild versions (in this case 17.0 and 17.4) will interpret <LangVersion>latest</LangVersion> differently, even though they display the same .NET SDK version and the same max supported language version, since I was expecting both of them to build the application as if latest == 10.0.