Skip to content

Commit 68c8848

Browse files
authored
Fix build when using source generators coming from NuGet package (#6799)
* Fix build when using source generators coming from NuGet package
1 parent 42ca808 commit 68c8848

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft.WinFX.targets

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,6 @@
435435
<_IntermediateOutputPathNoTargetFrameworkOrRID>$([System.Text.RegularExpressions.Regex]::Replace($(_IntermediateOutputPathNoTargetFrameworkOrRID), "$(TargetFramework)\\$",, System.Text.RegularExpressions.RegexOptions.IgnoreCase))</_IntermediateOutputPathNoTargetFrameworkOrRID>
436436
</PropertyGroup>
437437

438-
<ItemGroup>
439-
<!-- Include analyzers that are coming from a FrameworkReference in the temporary target assembly project. -->
440-
<_TemporaryTargetAssemblyAnalyzer Include="@(Analyzer)" Condition="'%(Analyzer.FrameworkReferenceName)' != ''" />
441-
</ItemGroup>
442-
443438
<!-- Use the legacy .NET Framework/.NET Core 3.0 GenerateTemporaryTargetAssembly path if 'IncludePackageReferencesDuringMarkupCompilation' is 'false',. -->
444439
<GenerateTemporaryTargetAssembly
445440
CurrentProject="$(MSBuildProjectFullPath)"
@@ -455,7 +450,7 @@
455450
CompileTargetName="$(_CompileTargetNameForLocalType)"
456451
GenerateTemporaryTargetAssemblyDebuggingInformation="$(GenerateTemporaryTargetAssemblyDebuggingInformation)"
457452
IncludePackageReferencesDuringMarkupCompilation="$(IncludePackageReferencesDuringMarkupCompilation)"
458-
Analyzers="@(_TemporaryTargetAssemblyAnalyzer)"
453+
Analyzers="@(Analyzer)"
459454
TemporaryTargetAssemblyProjectName="$(_TemporaryTargetAssemblyProjectName)"
460455
MSBuildProjectExtensionsPath="$(MSBuildProjectExtensionsPath)"
461456
>
@@ -491,6 +486,20 @@
491486
Condition="Exists('%(Fullpath)')" />
492487
</Target>
493488

489+
<!--
490+
===========================================
491+
RemoveDuplicateAnalyzers
492+
===========================================
493+
494+
Name : RemoveDuplicateAnalyzers
495+
-->
496+
<Target Name="RemoveDuplicateAnalyzers" BeforeTargets="CoreCompile">
497+
<ItemGroup>
498+
<FilteredAnalyzer Include="@(Analyzer->Distinct())" />
499+
<Analyzer Remove="@(Analyzer)" />
500+
<Analyzer Include="@(FilteredAnalyzer)" />
501+
</ItemGroup>
502+
</Target>
494503

495504
<!--
496505
================================================================

0 commit comments

Comments
 (0)