Skip to content

Commit 42ca808

Browse files
Fix build when using source generators coming from NuGet packages. (#6793)
Fixes #6792
1 parent 59fa4b1 commit 42ca808

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,11 @@
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+
438443
<!-- Use the legacy .NET Framework/.NET Core 3.0 GenerateTemporaryTargetAssembly path if 'IncludePackageReferencesDuringMarkupCompilation' is 'false',. -->
439444
<GenerateTemporaryTargetAssembly
440445
CurrentProject="$(MSBuildProjectFullPath)"
@@ -450,7 +455,7 @@
450455
CompileTargetName="$(_CompileTargetNameForLocalType)"
451456
GenerateTemporaryTargetAssemblyDebuggingInformation="$(GenerateTemporaryTargetAssemblyDebuggingInformation)"
452457
IncludePackageReferencesDuringMarkupCompilation="$(IncludePackageReferencesDuringMarkupCompilation)"
453-
Analyzers="@(Analyzer)"
458+
Analyzers="@(_TemporaryTargetAssemblyAnalyzer)"
454459
TemporaryTargetAssemblyProjectName="$(_TemporaryTargetAssemblyProjectName)"
455460
MSBuildProjectExtensionsPath="$(MSBuildProjectExtensionsPath)"
456461
>

0 commit comments

Comments
 (0)