Skip to content

Commit

Permalink
Allow individual projects to override LangVersion (dotnet#37512)
Browse files Browse the repository at this point in the history
Setting LangVersion in a .targets file makes it hard to override LangVersion in individual projects. Instead, move the default project setting back to the .props file and condition VB based on $(MSBuildProjectExtension), which is available in the .props file.

ILCompiler.Reflection.ReadyToRun needs to set LangVersion to 7.3 so it doesn't break ILSpy.

Fix dotnet#37498
  • Loading branch information
eerhardt authored Jun 8, 2020
1 parent 3218c66 commit 84abb55
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@

<!-- Language configuration -->
<PropertyGroup>
<!-- default to allowing all language features -->
<LangVersion>preview</LangVersion>
<LangVersion Condition="'$(MSBuildProjectExtension)' == '.vbproj'">latest</LangVersion>
<Deterministic>true</Deterministic>
</PropertyGroup>

Expand Down
7 changes: 0 additions & 7 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,4 @@
<NETCoreAppMaximumVersion>$(MajorVersion).$(MinorVersion)</NETCoreAppMaximumVersion>
</PropertyGroup>

<!-- Language configuration -->
<PropertyGroup>
<!-- default to allowing all language features -->
<LangVersion>preview</LangVersion>
<LangVersion Condition="'$(Language)' == 'VB'">latest</LangVersion>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<OutputPath>$(BinDir)</OutputPath>
<Platforms>AnyCPU;x64</Platforms>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 84abb55

Please sign in to comment.