I'm working with an older C# solution built on .NET Framework 4.8, which contains several libraries. Now, I'm developing a new solution targeting .NET 8 that needs to reuse some of those existing libraries.
For example, the old solution includes a configuration application that manages settings required by the new project, as well as a NetMQ library that handles data synchronization between services and clients. In total, there are eight libraries, some large, some small, that I need to integrate.
I’ve tried referencing the compiled DLLs from the old projects in the .NET 8 solution, but when running the application, I encounter various exceptions. One such example:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http.WebRequest, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Even after adding the corresponding NuGet package, the issue persists. This makes me wonder if it's even feasible to reference complex .NET Framework 4.8 libraries in a .NET 8 project.
Rewriting these libraries would be a significant effort, especially since there’s tight communication between components, and it’s absolutely critical that everything stays in sync.
So, how does this actually work? Is it still possible to reuse .NET Framework 4.8 libraries in a .NET 8 solution—and if so, how?
netstandard2.0in additional tonet481).<TargetFrameworks>net48;net8.0</TargetFrameworks>)MissingMethodExceptionin weird places, or errors likePlatformNotSupportedExceptionor other different behaviours.