Can a .NET Core 5.0 assembly use a .NET Framework 4.8-targeted assembly?

My C# assemblies currently all target .NET Core 3.1. They all use my C++/CLI assembly (call it "MySdk") that targets .NET Framework 4.8. This works fine.

Today I tried updating the C# assemblies to .NET 5.0. Suddenly, none of them even see the .NET FW 4.8 "MySdk" assembly that’s already built and sitting right there. The build process gives me output like this:

> 2>------ Build started: Project: MyApp.Core, Configuration: Debug x64
> ------ 2>C:Program Files (x86)Microsoft Visual Studio19CommunityMSBuildCurrentBinMicrosoft.Common.CurrentVersion.targets(2123,5):
> warning MSB3245: Could not resolve this reference. Could not locate
> the assembly "MySdk". Check to make sure the assembly exists on disk.
> If this reference is required by your code, you may get compilation
> errors.

The obvious solution is to update the C++/CLI assembly to .NET 5. And I want to do that soon, though I don’t know if it’s possible.

But let us suppose that’s not an option right now. Is it even valid for a .NET 5 assembly to use a .NET FW 4.8 assembly? Should this work? And is there anything else I can do to make my .NET 5 assemblies see and use this thing?

Source: Windows Questions C++

LEAVE A COMMENT