for context, working tutorial: https://code.msdn.microsoft.com/using-a-net-4-based-dll-bb141db3
my goal create com interface .net 4.5 dll in order use functionality in .net 2.0 context. vs 2013 solution consists of .net 4.5 project desired functionality, adapter project , .net 2.0 project.
the relevant code:
type myclassadaptertype = type.gettypefromprogid("net4tonet2adapter.myclassadapter"); object myclassadapterinstance = activator.createinstance(myclassadaptertype); imyclassadapter myclassadapter = (imyclassadapter)myclassadapterinstance; myclassadapter.donet4action();
this works when .net 2.0 project configured console application breaks when configured output class library. problem appears type.gettypefromprogid
returns null in case of class library.
a manifest file being used in .net 2.0 project in order specify dependancy on net4tonet2adapter
, suspicion class library configuration not handling correctly. have tried using mt.exe manually embed manifest no success.
what causing code fail when used dll?