Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch away from using PresentationBuildTasks and Microsoft.WinFx.targets from C:\Windows #9112

Open
KirillOsenkov opened this issue Jan 4, 2024 · 6 comments
Assignees

Comments

@KirillOsenkov
Copy link
Member

KirillOsenkov commented Jan 4, 2024

For WPF projects targeting net472, we should see if it's feasible to use the modern PresentationBuildTasks and Microsoft.WinFx.targets used by modern .NET 6/7/8.

We are already importing Microsoft.WinFx.targets from:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.WinFX.targets

However that's just a shim that's loading the C:\Windows copy using $(MSBuildFrameworkToolsPath)\Microsoft.WinFx.targets"

Modern WPF projects import this file instead:
C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets at (163;3)

Should we see if we can import this for desktop too?

This issue is causing an insane amount of pain in our ecosystem.

Related links:

Our ecosystem is hurting:

@KirillOsenkov
Copy link
Member Author

In this file:
https://github.com/dotnet/msbuild/blob/main/src/Tasks/Microsoft.WinFx.targets

we should experiment with adding logic that, if an opt-in property is set, we import the modern WPF tasks from the SDK (C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets) instead of the legacy tasks from C:\Windows.

I suggest that the MSBuild team spikes an experiment to see how cheap this is.

@KirillOsenkov
Copy link
Member Author

I forgot to mention another motivation behind this.

If we modernize WPF build tasks we'll be able to build WPF projects on Linux, which is currently not possible. Very often a codebase could have built on Linux but the WPF projects fail to build.

FYI @JanKrivanek

@rainersigwald
Copy link
Member

The only people who can provide the support needed to do this are the owners of the WPF tooling, so moving this to dotnet/wpf. The MSBuild team will happily help out.

@rainersigwald rainersigwald transferred this issue from dotnet/msbuild May 16, 2024
@ThomasGoulet73
Copy link
Contributor

Am I understanding correctly that the goal of this issue is for non-SDK style projects to use the same PresentationBuildTasks and Microsoft.WinFx.targets as SDK style projects ?

IIRC, SDK style .Net Framework projects already use the PresentationBuildTasks and Microsoft.WinFx.targets from the SDK.

@KirillOsenkov
Copy link
Member Author

@ThomasGoulet73 yes

@KirillOsenkov
Copy link
Member Author

@ThomasGoulet73 a minor correction: another goal (that I personally care the most about) is for SDK-style projects that use legacy WPF and target desktop framework (instead of UseWpf=true and targeting modern .NET) to work using the latest markup compiler and not the legacy targets/tasks from C:\Windows

@dipeshmsft dipeshmsft removed the Triaged label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants