Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logging source-gens duplication on WPF #5024

Merged
merged 10 commits into from
May 31, 2024
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
</Target>

<!-- This target will make sure that projects targeting net462 will also have the Microsoft.Extensions.Logging.Abstractions analyzer removed. -->
<Target Name="_Microsoft_Extensions_Logging_AbstractionsRemoveAnalyzers"
<Target Name="_Microsoft_Extensions_Logging_AbstractionsRemoveAnalyzers"
Condition="'$(DisableMicrosoftExtensionsLoggingSourceGenerator)' == 'true'"
AfterTargets="ResolveReferences">
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<!-- This package should replace the Microsoft.Extensions.Logging.Abstractions source generator. -->
<Target Name="_Microsoft_Extensions_Logging_AbstractionsRemoveAnalyzers"
<Target Name="_Microsoft_Extensions_Logging_AbstractionsRemoveAnalyzers"
Condition="'$(DisableMicrosoftExtensionsLoggingSourceGenerator)' == 'true'"
AfterTargets="ResolveReferences">
<ItemGroup>
Expand All @@ -13,4 +13,19 @@
<Analyzer Remove="@(_Microsoft_Extensions_Logging_AbstractionsAnalyzer)" />
</ItemGroup>
</Target>
</Project>
<Target Name="_Microsoft_Extensions_Logging_AbstractionsRemoveAnalyzersWPF"
xakep139 marked this conversation as resolved.
Show resolved Hide resolved
Condition="'$(DisableMicrosoftExtensionsLoggingSourceGenerator)' == 'true'"
AfterTargets="RemoveDuplicateAnalyzers">
<ItemGroup>
<_Microsoft_Extensions_Logging_AbstractionsAnalyzerWPF
Include="@(Analyzer)"
Condition="'%(Analyzer.NuGetPackageId)' == 'Microsoft.Extensions.Logging.Abstractions' Or
'%(Analyzer.AssemblyName)' == 'Microsoft.Extensions.Logging.Generators'" />
</ItemGroup>

<!-- Remove Microsoft.Extensions.Logging.Abstractions Analyzer for WPF projects -->
<ItemGroup>
<Analyzer Remove="@(_Microsoft_Extensions_Logging_AbstractionsAnalyzerWPF)" />
</ItemGroup>
</Target>
</oject>
xakep139 marked this conversation as resolved.
Show resolved Hide resolved