Reputation: 5434
Is it possible to use WPF within an .NET Standard Class Library or is this to be reserved for .NET Core? If so, is it possible to setup a .NET Core Class Library that uses WPF or does it necessarily have to be a .NET Core App?
Upvotes: 4
Views: 7038
Reputation: 5434
Finally, I got in contact with Microsoft. They were very helpful and provided the following snippet of a *.csproj
file to me:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>
With this, I get a .NET Core class library including WPF. Additionally, I had to remove App.xaml
and App.cs
. This was necessary since those contain <Application>
tags in XAML which aren’t allowed in WPF libraries.
Upvotes: 5