How to resolve the problem with CLR dependencies using C# and C++/CLI dlls
There are two .dll files, one written in C++ (providing an API via P/Invoke), and the other in C# (.NET 4.5.2), which exports it. There was a need to rewrite everything in C++/CLI. Everything was done, and if you run the resulting output through a test utility in the build output folder, it works perfectly. However, when copying to the server (also written in C#, .NET 4.8), an exception System.IO.FileNotFoundException: Could not load file or assembly referencing a CLR DLL occurs. This happens at the moment of binding C# delegates and static methods of the new CLR class in the C++ library (I tried doing it without delegates - the result is the same. I also tried creating a full class object and referencing its method in the delegate - the same result). Moreover, if you combine the old P/Invoke and the new CLR, the exception only occurs when accessing the new API, while P/Invoke calls link normally. Both libraries are in the same path on the server, in the same folder. In the reference settings for the C# library, I specified the path to the C++/CLI DLL in the build output directory - to no avail.