Jay Vansjalia
Jay Vansjalia

Reputation: 113

How can I use existing .net framework 4.8 class library in .NET 6 project?

We have .NET 6 Blazor Server-side project in Visual Studio 2022. We would like to use .Net Framework 4.8 class library in .NET 6. In this class library, we are using System.Windows.Form and we cannot recompile the class library with .NET Standard 2.0.

I have added .Net Framework 4.8 class library project as dependency for Blazor Application. I am able to compile the solution but when try to run the Blazor Application then it complaints with "System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.".

We would just like to run Blazor project in windows only.

Upvotes: 10

Views: 11319

Answers (1)

Kissaki
Kissaki

Reputation: 9237

You can target newer .NET versions with inclusion of Windows forms.

See the official guidance

Upvotes: -1

Related Questions