Have a look at the guidance here and this issue report.
It looks like you need to change your C++/CLI settings from .NET FW to be for .NET 6 (which your C# project appears to be).
can not load C++/CLR in a native C++ dll
Hello,
I'm facing a challenge in configuring my project and I need help. My goal is to use C# code in an unmanaged native C++ project by utilizing C++/CLR. However, I'm currently encountering the following error.
*Error:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'CSharper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. at mainTest()
I suspect that the issue lies in my configuration or i miss runtime information, but I'm not sure how to resolve it. Could someone assist me and provide steps for configuring my project to address the error mentioned above?
My test project https://github.com/Brunner246/SharpCpp
Wrapper Library (C++/Clr)
https://github.com/Brunner246/SharpCpp/blob/master/SharpCpp/SharpCpp.cpp
native c++ Library
https://github.com/Brunner246/SharpCpp/blob/master/LibraryTest/dllmain.cpp
Thank you in advance for your assistance.
Developer technologies | .NET | .NET Runtime
Developer technologies | C++
Developer technologies | .NET | Other
-
David Lowndes 2,640 Reputation points MVP
2023-11-04T17:12:45.86+00:00