I have declared an interface in C++/CLI and made it an assembly(DLL). I want that interface to be implement by a C# app. I have added the reference but my C# assembly does not detecting my C++/CLI interface and says "Could not find: You are missing some assembly refernce."
How can I resolve this?
Make sure that your dll support CLR. (Tab General in Configuration Properties in Visual Studio).
Make sure that the interface class
is declared public
in the C++/CLI assembly. I recommend the free version of Red Gate .NET Reflector for viewing visibility of types in a compiled assembly.
Is the interface defined within a namespace within the C++/CLI assembly? If so have you put 'using [namespace]' at the top of your C# file?
Knowing this is an old question, but I had the same issue. Additionally, your c++/cli needs to provide some source (cpp) code (which is actually nearly empty):
IXYprovider.h:
namespace Interfaces { public interface class IXYprovider { ... } }
IXYProvider.cpp:
#include "IXYprovider.h" namespace Interfaces { }
That makes it visible to C#.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.