Skip to content

Commit

Permalink
Merge pull request #23 from ByronMayne/21-project-non-version-format-…
Browse files Browse the repository at this point in the history
…of-langversion-fails-to-build

Fixed the compiler error for using min version of the `LangVersion` when you you use `latest`
  • Loading branch information
ByronMayne authored Jul 27, 2024
2 parents 375278a + 11f285d commit e7f4be9
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,20 @@
</Target>
<!-- Validates they are at least using LangVersion 7.3 for nullable refernece types-->
<Target Name="SGF_LangVersionValidation" BeforeTargets="CoreCompile">
<ItemGroup>
<NamedVersion Include="preview"/>
<NamedVersion Include="preview"/>
<NamedVersion Include="latest"/>
<NamedVersion Include="latestMajor"/>
</ItemGroup>
<PropertyGroup>
<MinLangVersion>7.2</MinLangVersion>
<IsNamedVersion>false</IsNamedVersion>
<IsNamedVersion Condition="'%(NamedVersion.Identity)' == '$(LangVersion)'">true</IsNamedVersion>
</PropertyGroup>
<Error
Condition="$([MSBuild]::VersionGreaterThan('$(MinLangVersion)', '$(LangVersion)'))"
Condition="!$(IsNamedVersion) AND $([MSBuild]::VersionGreaterThan('$(MinLangVersion)', '$(LangVersion)'))"
Text="[SourceGenerator.Foundations] The project $(MSBuildProjectName) is currently using the language version $(LangVersion) which does not meet the minimum required of $(MinLangVersion). Read how to change it here https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version" />
</Target>

</Project>

0 comments on commit e7f4be9

Please sign in to comment.