Minor tweaks to MSBuild checks

This commit is contained in:
Sergio Pedri 2022-01-14 13:01:33 +01:00
Родитель 408c44b4a5
Коммит 0d894ea7c9
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -13,7 +13,7 @@
DependsOnTargets="_MVVMToolkitGatherAnalyzers">
<Choose>
<When Condition="$(CSharpCoreTargetsPath) != ''">
<When Condition="'$(CSharpCoreTargetsPath)' != ''">
<!-- Use the CSharpCoreTargetsPath property to find the version of the compiler we are using. This is the same mechanism
MSBuild uses to find the compiler. We could check the assembly version for any compiler assembly (since they all have
@ -30,18 +30,18 @@
<!-- The CurrentCompilerVersionIsNotNewEnough property can now be defined based on the Roslyn assembly version -->
<CurrentCompilerVersionIsNotNewEnough Condition="$([MSBuild]::VersionLessThan($(CurrentCompilerVersion), 4.0))">true</CurrentCompilerVersionIsNotNewEnough>
<CurrentCompilerVersionIsNotNewEnough Condition="$(CurrentCompilerVersionIsNotNewEnough) == ''">false</CurrentCompilerVersionIsNotNewEnough>
<CurrentCompilerVersionIsNotNewEnough Condition="'$(CurrentCompilerVersionIsNotNewEnough)' == ''">false</CurrentCompilerVersionIsNotNewEnough>
</PropertyGroup>
<!-- If the Roslyn version is < 4.0, disable the source generators -->
<ItemGroup Condition ="$(CurrentCompilerVersionIsNotNewEnough) == 'true'">
<ItemGroup Condition ="'$(CurrentCompilerVersionIsNotNewEnough)' == 'true'">
<Analyzer Remove="@(_MVVMToolkitAnalyzer)"/>
</ItemGroup>
<!-- If the source generators are disabled, also emit a warning. This would've been produced by MSBuild itself as well, but
emitting this manually lets us customize the message to inform developers as to why exactly the generators have been
disabled, and that the rest of the MVVM Toolkit will still keep working as intended, just without additional features. -->
<Warning Condition ="$(CurrentCompilerVersionIsNotNewEnough) == 'true'" Text="The MVVM Toolkit source generators have been disabled on the current configuration, as they need Roslyn 4.x in order to work. The MVVM Toolkit will work just fine, but features relying on the source generators will not be available."/>
<Warning Condition ="'$(CurrentCompilerVersionIsNotNewEnough)' == 'true'" Text="The MVVM Toolkit source generators have been disabled on the current configuration, as they need Roslyn 4.x in order to work. The MVVM Toolkit will work just fine, but features relying on the source generators will not be available."/>
</When>
<Otherwise>