Alex I
Alex I

Reputation: 2400

.NET Core console app references .NET Framework assembly

Sorry for the question, I must be missing something, or doing something completely wrong.

I just created a .NET Core 3.1 console app that references a .NET Framework 4.8 assembly. The console app calls some methods in the referenced assembly. My question is: why does it compile and run?

Upvotes: 2

Views: 478

Answers (1)

Erko
Erko

Reputation: 391

This works because of the .NET Framework compatibility mode

Starting with .NET Standard 2.0, the .NET Framework compatibility mode was introduced. This compatibility mode allows .NET Standard and .NET Core projects to reference .NET Framework libraries. Referencing .NET Framework libraries doesn't work for all projects, such as if the library uses Windows Presentation Foundation (WPF) APIs, but it does unblock many porting scenarios.

.NET Framework compatibility mode

Upvotes: 3

Related Questions