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

1 Answer 1

6

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>
Sign up to request clarification or add additional context in comments.

2 Comments

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?
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.