Brightspace / rules_csharp

Bazel rules for C#
Apache License 2.0
8 stars 5 forks source link

Make the default langversion configurable #15

Closed j3parker closed 4 years ago

j3parker commented 5 years ago

Currently we default to C# 7.3 (because that's what D2L uses). I think this should probably be configurable at the workspace level.

j3parker commented 4 years ago

To test:

If we make a csproj with <TargetFrameworks>net20;net48</TargetFrameworks>, what does MSBuild do for the langauge version?

If it chooses "the latest supported language version for your framework" by default (we have some suspicions that this might be the case) does it mean you need #ifdefs to use newer language features?

If you set an explicit value in your csproj does it apply for all frameworks or is there any sort of ceiling logic going on? (Seems unlikely).

omsmith commented 4 years ago

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version

omsmith commented 4 years ago
Target framework version C# language version default
.NET Core 3.x C# 8.0
.NET Core 2.x C# 7.3
.NET Standard all C# 7.3
.NET Framework all C# 7.3
omsmith commented 4 years ago

I'm not sure I believe that netstandard2.1 defaults to 7.3. Did they not add all the fancy features to 2.1?