Reputation: 3290
I recently wrote a small native c++ wrapper in C++/CLI. Its a simple program. I am able to compile it properly and able to add the dll refeernce in my C# project without any errors. I can also create the object from this CPP/CLI dll and access the functions at compile time without any errors.
Now When I run the program, The first function call which references the object from this dll throws an exception. The exception is as follows:
Could not load file or assembly 'ProtobufWrapper, Version=1.0.4381.26401, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
I am not sure what is wrong in my case.
Upvotes: 3
Views: 3212
Reputation: 3398
Is the DLL file located in the same directory as the .Exe you're starting? Sometimes the file won't get copied and can't be found.
On the DLL reference click properties and check for build action. Set it to Copy.
Upvotes: 2