can not load C++/CLR in a native C++ dll

Michael Brunner 40 Reputation points
2023-11-04T16:34:57.68+00:00

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?debug

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
{count} votes

Accepted answer
  1. David Lowndes 2,640 Reputation points MVP
    2023-11-04T17:12:45.86+00:00

    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).

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.