Home > Blockchain >  How Can I use .NET Framework 4.8 on an WPF Class Library?
How Can I use .NET Framework 4.8 on an WPF Class Library?

Time:01-14

So I want to create an WPF Class Library but in the .NET Framework 4.8. But in the creating I only get this two Frameworks to choose:

Version

How Can I get .NET Framework 4.8 in this to Choose? Because when I just use the normal Class Library, without the WPF in the name I can only add an UserControl. I cant choose in that something like Ressource dictionary for example

CodePudding user response:

Choose

WPF User Control Library (.NET Framework)

or

WPF Custom Control Library (.NET Framework)

instead of

WPF Class Library

as project template.


Alternatively, replace

<PropertyGroup>
    <TargetFramework>net6.0-windows</TargetFramework>
    <Nullable>enable</Nullable>
    <UseWPF>true</UseWPF>
</PropertyGroup>

with

<PropertyGroup>
    <TargetFramework>net48</TargetFramework>
    <UseWPF>true</UseWPF>
</PropertyGroup>

in the project file (.csproj).


You can also support multiple target frameworks like this:

<TargetFrameworks>net6.0-windows;net48</TargetFrameworks>
  •  Tags:  
  • Related