4

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

Sir Rufo
  • 18,395
  • 2
  • 39
  • 73

1 Answers1

4

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>
Clemens
  • 123,504
  • 12
  • 155
  • 268
  • Where did I get WPF User Control Library ? Because I dont have this names on the list. And the TargetFramework, in which File did I find this? –  Jan 13 '22 at 15:40
  • TargetFramework is in the .csproj file. Double click on the project in Visual Studio. For the project templates, the appropriate Workloads must be installed in Visual Studio Installer. – Clemens Jan 13 '22 at 15:41