I have a third party provider who provide me a set of DLL files as part of their .NET API. They enclose a Python and C# example. I have been using their API via Python (using pythonnet) for a while.
The C# workflow in comparison is dotnet build
and dotnet run
. This appears to generate a .dll and execute that.
Now, for performance reasons, I want to use their API in Native C++. I am trying to build a C++/CLI project in Visual Studio 2022. I follow these steps
- Create a C++/CLI project target a .NET Core 5.0 (because the C# example does that)
- Add their .dll files as Reference
I am able to refer to their objects, with appropriate definitions, and the Intellisense typechecker is satisfied. But when I try to execute the code, it gives me an error
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module. Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
I do not think the exact error is relevant, I am simply out of depth about how .net works and if it even makes to do what I am trying to do.
How do I achieve an equivalent C++ project setup with interop?