What is the best way to use a .NET Framework 4 (.NET 4) assembly with a .NET 5.0 or newer application? I assume the .NET 4 assembly cannot exist in the same process as the .NET 5 application. It seems like it should be possible to create a stub proxy like in the COM world. A less ideal solution could be to create a separate program with a WebAPI or a gRPC interface. By the way, we do not have the code to the .NET 4 assembly. It's a third-party library.
Asked
Active
Viewed 224 times
1
-
1Good question. Yes, .NET Core [will create such a stub proxy automatically](https://stackoverflow.com/a/56033640/87698), but the Framework DLL will be limited to APIs supported by .NET (Core) 5.0 and fail at runtime when an unsupported method is used. Yes, a separate binary that runs the classic .NET framework would be the most *safe* solution. I wonder whether it would be possible to host the classic framework inside a .NET Core process (just like you can host the .NET Framework within an unmanaged process), but I haven't found any references on that. Maybe no-one tried it yet. – Heinzi Jan 18 '21 at 18:35