I've got a managed C++ base assembly (BaseAssembly) that defines an interface:
namespace BaseAssembly
{
public interface class IMyInterface
{
};
}
Two other managed C++ assemblies each contain a class that implements this interface:
#include "MyInterface.h";
namespace DerivedAssembly1
{
public ref class MyDerived1 : public BaseAssembly::IMyInterface
{
};
}
#include "MyInterface.h";
namespace DerivedAssembly2
{
public ref class MyDerived2 : public BaseAssembly::IMyInterface
{
};
}
When I try to create an instance of IMyInterfaces in a separate C# app, I get error CS0433: The type BaseAssembly.IMyInterface exists in both MyDerived1.dll and MyDerived2.dll. Im not sure how to proceed.
Heres a snippet of the offending C# code:
namespace MyApp
{
public class MyClientApp
{
public void Initialize()
{
IMyInterface impl = new MyDerived1();
}
}
}
The C# project references both derived assemblies. I've tried leaving the base assembly as a bare header file (i.e. not compiling it to a DLL), and compiling it to a DLL and referencing it from the C# project. Nothing seems to work. Thanks in advance for your help.