From 5c820b598778ba30c0f1b79e885cfc73bd9dfc7d Mon Sep 17 00:00:00 2001 From: ThomasGoulet73 Date: Wed, 4 May 2022 23:31:24 -0400 Subject: [PATCH] Fix build when using Razor source generator Fixes dotnet/wpf#4421 --- .../src/PresentationBuildTasks/Microsoft.WinFX.targets | 1 + .../Tasks/Windows/GenerateTemporaryTargetAssembly.cs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft.WinFX.targets b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft.WinFX.targets index 903018db4bf..e696d45b26c 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft.WinFX.targets +++ b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft.WinFX.targets @@ -452,6 +452,7 @@ Analyzers="$(Analyzers)" TemporaryTargetAssemblyProjectName="$(_TemporaryTargetAssemblyProjectName)" MSBuildProjectExtensionsPath="$(MSBuildProjectExtensionsPath)" + RootNamespace="$(RootNamespace)" > diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs index 3be2dc23773..68f872c3dd5 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs @@ -274,6 +274,7 @@ private bool ExecuteGenerateTemporaryTargetAssemblyWithPackageReferenceSupport() ( nameof(BaseIntermediateOutputPath), BaseIntermediateOutputPath ), ( nameof(MSBuildProjectExtensionsPath), MSBuildProjectExtensionsPath ), ( "_TargetAssemblyProjectName", Path.GetFileNameWithoutExtension(CurrentProject) ), + ( nameof(RootNamespace), RootNamespace ), ( nameof(Analyzers), Analyzers ) }; @@ -484,6 +485,14 @@ public bool GenerateTemporaryTargetAssemblyDebuggingInformation public string Analyzers { get; set; } + /// + /// RootNamespace + /// + /// Required for Source Generator support. May be null. + /// + /// + public string RootNamespace { get; set; } + /// /// BaseIntermediateOutputPath ///