dotnet / dotnet/project-system

`UseWindowsForms` and `UseWPF` properties should be always available when targeting Windows

Open
#9,098 4 comments 0 reactions 1 assignee Claimed by @melytc View on GitHub
Feature-Project-Properties-Designer Triage-Approved
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

It's common for libraries and console applications to use miscellaneous APIs from Windows Forms or WPF. In legacy-style projects, you would use "Add Reference" to add `System.Windows.Forms` to your application or library. Today it's not possible to do the same with SDK-style projects without manually editing the project file. Though we do expose `UseWindowsForms` and `UseWPF` in the project properties, they are only visible when the output type is `WinExe` (i.e. not a console application or library).

However, as of .NET 5, we have a more appropriate key for these properties—the target OS. We should change these properties to be visible when `TargetPlatformIdentifier`==`Windows`, rather than when `OutputType`==`WinExe`.

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.