Skip to content

Commit 90f1db2

Browse files
authored
Merge pull request #321 from CommunityToolkit/dev/fix-targets-conflicts
Add unique prefixes to all .targets properties and items
2 parents a2c9313 + 86aaa99 commit 90f1db2

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.targets

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
11
<Project>
22

33
<!-- Get the analyzer from the CommunityToolkit.Mvvm NuGet package -->
4-
<Target Name="_MVVMToolkitGatherAnalyzers">
4+
<Target Name="MVVMToolkitGatherAnalyzers">
55
<ItemGroup>
6-
<_MVVMToolkitAnalyzer Include="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)' == 'CommunityToolkit.Mvvm'" />
6+
<MVVMToolkitAnalyzer Include="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)' == 'CommunityToolkit.Mvvm'" />
77
</ItemGroup>
88
</Target>
99

1010
<!-- Remove the analyzer if using Roslyn 3.x (incremental generators require Roslyn 4.x) -->
11-
<Target Name="_MVVMToolkitRemoveAnalyzersForRoslyn3"
11+
<Target Name="MVVMToolkitRemoveAnalyzersForRoslyn3"
1212
Condition="'$(CSharpCoreTargetsPath)' != ''"
1313
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
14-
DependsOnTargets="_MVVMToolkitGatherAnalyzers">
14+
DependsOnTargets="MVVMToolkitGatherAnalyzers">
1515

1616
<!-- Use the CSharpCoreTargetsPath property to find the version of the compiler we are using. This is the same mechanism
1717
MSBuild uses to find the compiler. We could check the assembly version for any compiler assembly (since they all have
1818
the same version) but Microsoft.Build.Tasks.CodeAnalysis.dll is where MSBuild loads the compiler tasks from so if
1919
someone is getting creative with msbuild tasks/targets this is the "most correct" assembly to check. -->
2020
<GetAssemblyIdentity AssemblyFiles="$([System.IO.Path]::Combine(`$([System.IO.Path]::GetDirectoryName($(CSharpCoreTargetsPath)))`,`Microsoft.Build.Tasks.CodeAnalysis.dll`))">
21-
<Output TaskParameter="Assemblies" ItemName="CurrentCompilerAssemblyIdentity"/>
21+
<Output TaskParameter="Assemblies" ItemName="MVVMToolkitCurrentCompilerAssemblyIdentity"/>
2222
</GetAssemblyIdentity>
2323

2424
<PropertyGroup>
2525

2626
<!-- Transform the resulting item from GetAssemblyIdentity into a property representing its assembly version -->
27-
<CurrentCompilerVersion>@(CurrentCompilerAssemblyIdentity->'%(Version)')</CurrentCompilerVersion>
27+
<MVVMToolkitCurrentCompilerVersion>@(MVVMToolkitCurrentCompilerAssemblyIdentity->'%(Version)')</MVVMToolkitCurrentCompilerVersion>
2828

2929
<!-- The CurrentCompilerVersionIsNotNewEnough property can now be defined based on the Roslyn assembly version -->
30-
<CurrentCompilerVersionIsNotNewEnough Condition="$([MSBuild]::VersionLessThan($(CurrentCompilerVersion), 4.0))">true</CurrentCompilerVersionIsNotNewEnough>
30+
<MVVMToolkitCurrentCompilerVersionIsNotNewEnough Condition="$([MSBuild]::VersionLessThan($(MVVMToolkitCurrentCompilerVersion), 4.0))">true</MVVMToolkitCurrentCompilerVersionIsNotNewEnough>
3131
</PropertyGroup>
3232

3333
<!-- If the Roslyn version is < 4.0, disable the source generators -->
34-
<ItemGroup Condition ="'$(CurrentCompilerVersionIsNotNewEnough)' == 'true'">
35-
<Analyzer Remove="@(_MVVMToolkitAnalyzer)"/>
34+
<ItemGroup Condition ="'$(MVVMToolkitCurrentCompilerVersionIsNotNewEnough)' == 'true'">
35+
<Analyzer Remove="@(MVVMToolkitAnalyzer)"/>
3636
</ItemGroup>
3737

3838
<!-- If the source generators are disabled, also emit a warning. This would've been produced by MSBuild itself as well, but
3939
emitting this manually lets us customize the message to inform developers as to why exactly the generators have been
4040
disabled, and that the rest of the MVVM Toolkit will still keep working as intended, just without additional features. -->
41-
<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."/>
41+
<Warning Condition ="'$(MVVMToolkitCurrentCompilerVersionIsNotNewEnough)' == '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."/>
4242
</Target>
4343

4444
<!-- Remove the analyzer if Roslyn is missing -->
45-
<Target Name="_MVVMToolkitRemoveAnalyzersForRosynNotFound"
45+
<Target Name="MVVMToolkitRemoveAnalyzersForRosynNotFound"
4646
Condition="'$(CSharpCoreTargetsPath)' == ''"
4747
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
48-
DependsOnTargets="_MVVMToolkitGatherAnalyzers">
48+
DependsOnTargets="MVVMToolkitGatherAnalyzers">
4949

5050
<!-- If no Roslyn assembly could be found, just remove the analyzer without emitting a warning -->
5151
<ItemGroup>
52-
<Analyzer Remove="@(_MVVMToolkitAnalyzer)"/>
52+
<Analyzer Remove="@(MVVMToolkitAnalyzer)"/>
5353
</ItemGroup>
5454
</Target>
5555

0 commit comments

Comments
 (0)