From 601f3c5ec89a78925a28a668c4dd55516349f744 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Mon, 4 Nov 2024 08:27:10 +0100 Subject: [PATCH] Use live runtime references for vcxproj Fixes https://github.com/dotnet/wpf/issues/9490 Unblocks https://github.com/dotnet/sdk/pull/43015 When building wpf inside the VMR, a 10.0.100 SDK is used. WPF currently still targets net9.0. As WPF directly depends on runtime, it already uses 10.0.0-alpha versions of the targeting and runtime packs for managed projects. Enable this for vcxprojs as well so that the host packages can also be restored from the flowing runtime dependency. Fixes errors like these: > 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: D:\a\_work\1\vmr\.dotnet\packs\Microsoft.NETCore.App.Host.win-x64, targetframework: net9.0, Pack PackageId: Microsoft.NETCore.App.Host.win-x64, Pack Package Version: 9.0.0-rc.2.24473.5 --- eng/Tools.props | 15 -- .../tools/RuntimeFrameworkReference.props | 1 + .../tools/RuntimeFrameworkReference.targets | 65 +------- eng/WpfArcadeSdk/tools/Wpf.Cpp.targets | 154 ------------------ .../DirectWriteForwarder.vcxproj | 7 +- .../System.Printing/System.Printing.vcxproj | 8 +- 6 files changed, 4 insertions(+), 246 deletions(-) delete mode 100644 eng/Tools.props diff --git a/eng/Tools.props b/eng/Tools.props deleted file mode 100644 index 1393e1776e8..00000000000 --- a/eng/Tools.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - <_RuntimeIdentifier Condition="'$(Platform)' == ''">win-x86 - <_RuntimeIdentifier Condition="'$(Platform)' != ''">win-$(Platform) - - - - - - - - - - diff --git a/eng/WpfArcadeSdk/tools/RuntimeFrameworkReference.props b/eng/WpfArcadeSdk/tools/RuntimeFrameworkReference.props index ff7880c6991..ed45ed7321d 100644 --- a/eng/WpfArcadeSdk/tools/RuntimeFrameworkReference.props +++ b/eng/WpfArcadeSdk/tools/RuntimeFrameworkReference.props @@ -2,6 +2,7 @@ true + true diff --git a/eng/WpfArcadeSdk/tools/RuntimeFrameworkReference.targets b/eng/WpfArcadeSdk/tools/RuntimeFrameworkReference.targets index 6dd7eb19ed8..a9f423ccda7 100644 --- a/eng/WpfArcadeSdk/tools/RuntimeFrameworkReference.targets +++ b/eng/WpfArcadeSdk/tools/RuntimeFrameworkReference.targets @@ -6,11 +6,7 @@ - - + Condition="'$(MSBuildProjectExtension)'!='.vcxproj' or '$(ManagedCxx)'=='true'"/> - - false - false - false - - false - - - - - - - - - - - - - - - <_ResolvedRuntimePackPath>@(ResolvedRuntimePack->WithMetadataValue('FrameworkName', 'Microsoft.NETCore.App')->Metadata('Path')) - - - - - $(NuGetPackageRoot)microsoft.netcore.app.ref\$(MicrosoftNETCoreAppRefVersion) - $(MicrosoftNETCoreAppRefVersion) - $(_ResolvedRuntimePackPath) - $(MicrosoftNETCoreAppRuntimewinx64Version) - - - - - - - - - @(ResolvedAppHostPack->'%(Path)') - - - - @(ResolvedIjwHostPack->'%(Path)') - - - diff --git a/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets b/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets index d98a8708e26..3d761def5d4 100644 --- a/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets +++ b/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets @@ -276,160 +276,6 @@ using namespace System::Runtime::Versioning; - - - - CppCliHelper; - $(ResolveReferencesDependsOn) - - - $(EnsureWpfProjectReferenceDependsOn); - CppCliHelper - - - - - - - - $(IntermediateOutputPath)CppCliSupport\CppClrSupport_$(MSBuildProjectName).csproj - - - - - - - - - net6.0 - AnyCPU%3Bx64%3Barm64 - - ]]> - - - - - - - - - <_AdditionalPackages Remove="%40(_AdditionalPackages)" /> - <_AdditionalPackages Include="%24(AdditionalPackages)" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ]]> - - - - - - - - - - - - - - - AdditionalPackages=@(AdditionalPackageReference->'%(Identity)+%(Version)') - - - - - - - - - - False - - - - - - - - - CppHelper; diff --git a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/DirectWriteForwarder.vcxproj b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/DirectWriteForwarder.vcxproj index 55531081afc..95dc1ea07e8 100644 --- a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/DirectWriteForwarder.vcxproj +++ b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/DirectWriteForwarder.vcxproj @@ -28,8 +28,6 @@ true - .NETCoreApp - Unknown - + - +