WPF VCXProj projects should build against the runtime version it references
WPF's VCXProj projects build against the targeting pack from the SDK. This creates problems like https://github.com/dotnet/wpf/issues/9309 where WPF ends up building against older references than it ships with. It also causes problems where SDK's VMR build fails because it forces WPF to build with the latest runtime which might introduce a compiler warning due to new API - https://github.com/dotnet/wpf/pull/9135.
Instead WPF should build against the version of runtime that it depends on.
I see VCXProj's are excluded - https://github.com/dotnet/wpf/blob/4c0bdd0d1a3002ff5f8be987220019fd98131b57/eng/WpfArcadeSdk/tools/RuntimeFrameworkReference.targets#L15-L36
If I try to remove that exclusion I see:
C:\src\dotnet\wpf\.dotnet\sdk\9.0.100-preview.5.24307.3\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(157,5): error NETSDK1145: The Apphost pack is not installed and NuGet package restore is not supported. Upgrade Visual Studio, remove global.json if
it specifies a certain SDK version, and uninstall the newer SDK. For more options visit https://aka.ms/targeting-apphost-pack-missing Pack Type:Apphost, Pack directory: C:\src\dotnet\wpf\.dotnet\packs\Microsoft.NETCore.App.Host.win-x86, targetframework: net9.0, Pack PackageId: Microsoft.
NETCore.App.Host.win-x86, Pack Package Version: 9.0.0-rc.1.24379.3 [C:\src\dotnet\wpf\src\Microsoft.DotNet.Wpf\src\DirectWriteForwarder\DirectWriteForwarder.vcxproj]
We ought to be able to workaround this somehow. Even if the VCXProj can't do the restore, other projects in the repo will do it, and the VCXproj should be able to get the path.
Here's the relevant place in the SDK that error comes from https://github.com/dotnet/sdk/blob/68cf2826f641034012815a989fd4933e759f249f/src/Tasks/Microsoft.NET.Build.Tasks/ResolveAppHosts.cs#L295C26-L305
I think WPF could set EnableManagedPackageReferenceSupport to avoid this:
https://devblogs.microsoft.com/cppblog/announcing-nuget-packagereference-support-for-c-cli-msbuild-projects-targeting-net-core/