Consider making FrameworkReferences implicit in WPF and Web SDKs
See original GitHub issueIn .NET Core 3.0, a WPF project will import the WPF SDK in its project element (<Project Sdk="Microsoft.NET.Sdk.Wpf">
), and will also have a FrameworkReference to Microsoft.DesktopUI (<FrameworkReference Include="Microsoft.DesktopUI"/>
). Similarly, ASP.NET Core projects will use the Microsoft.NET.Sdk.Web
SDK, and will have a FrameworkReference to Microsoft.AspNetCore
.
Having to specify both the Sdk and the FrameworkReference seems redundant. They do serve separate purposes: the FrameworkReference allows you to use the APIs in the shared framework, while the Sdk import brings in the build logic (for example, razor or xaml compilation, or default globs for the project type).
We should consider having WPF and Web SDKs by default include an implicit FrameworkReference to the corresponding shared framework, and removing the FrameworkReferences from the project templates.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (10 by maintainers)
Top GitHub Comments
One advantage of an implicit FrameworkReference is that it could make it easier to multi-target a WPF project. It would be an error to specify a FrameworkReference if targeting .NET Framework, so you’d have to add a condition on the FrameworkReference item. However, if the FrameworkReference was implicit in the SDK, and the SDK also implicitly referenced a default set of WPF assemblies when targeting .NET Framework, then you could convert a .NET Core WPF project to multi-target to .NET Framework just by replacing
<TargetFramework>netcoreapp3.0</TargetFramework>
with<TargetFrameworks>netcoreapp3.0;net472</TargetFrameworks>
This is now part of the latest build of the .NET Core SDK.