dotnet / dotnet/wpf

WPF VCXProj projects should build against the runtime version it references

Open
#9,490 1 comment 2 reactions 0 assignees View on GitHub
:construction: work in progress
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.