Search code examples
dllimportwindows-phone-8c++-clitransplant

cannot add C++/CLI dll to windows phone


I have a C++/CLI project which produce a DLL. C# project can successfully call this DLL.

Then I want to call this DLL in my windows phone project.

So I changed the C++/CLI project's "Property Page->general->Platform Toolset" to Windows Phone 8.0(v110). Then I changed its "Property Page->Platform" to Active(ARM).

after some bugs fixed, I try to reference new DLL in my windows phone project, only to receive this Error : "A reference to a higher version or incompatible assembly cannot be added to the project".

YOU CAN HEAR MY HEART BREAKS!!!

What I should do now? What kind of DLL can a windows phone project reference?? Or another way to import this project to windows phone project ??? Thanks.


Solution

  • To have that work, you need to create a Windows Phone Runtime project that your main WP8 project can reference. In it, you can reference your c++/CLI dll and then create whatever wrapper/interface methods you need to do work on it. This previous question explains that process, along with a link to a sort-of tutorial on it.