-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
WPF's VCXProj projects build against the targeting pack from the SDK. This creates problems like #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 - #9135.
Instead WPF should build against the version of runtime that it depends on.
I see VCXProj's are excluded -
wpf/eng/WpfArcadeSdk/tools/RuntimeFrameworkReference.targets
Lines 15 to 36 in 4c0bdd0
<FrameworkReference Update="Microsoft.NETCore.App" | |
Condition="'$(MicrosoftNETCoreAppRefVersion)'!='' | |
And '$(NoTargets)'!='true' | |
And '$(TargetFrameworkIdentifier)' == '.NETCoreApp' | |
And $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '3.0')) | |
And '$(MSBuildProjectExtension)'!='.vcxproj'"> | |
<TargetingPackVersion>$(MicrosoftNETCoreAppRefVersion)</TargetingPackVersion> | |
</FrameworkReference> | |
<!-- | |
Workaround - this should be removed when our tests are converted from Microsoft.NET.Sdk.WindowsDesktop => Microsoft.NET.Sdk | |
project | |
--> | |
<KnownFrameworkReference Remove="Microsoft.AspNetCore.App" /> | |
</ItemGroup> | |
<PropertyGroup> | |
<RuntimeFrameworkVersion Condition="'$(MicrosoftNETCoreAppRuntimewinx64Version)'!='' And | |
'$(NoTargets)'!='true' And | |
'$(TargetFrameworkIdentifier)' == '.NETCoreApp' And | |
$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '3.0')) And | |
'$(MSBuildProjectExtension)'!='.vcxproj'">$(MicrosoftNETCoreAppRuntimewinx64Version)</RuntimeFrameworkVersion> |
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.