Hosting .NET Runtime in C++ Tip o’ the day or "Where is IAppDomainSetup?"

Are you hosting the .NET runtime and trying to create another AppDomain? Notice that you need to call CreateDomainSetup and cast the IUnknown to IAppDomainSetup to set properties? Notice also that IAppDomainSetup isn't defined in mscoree.h? Add the following (stdafx.h or anywhere else):

#import <mscorlib.tlb> raw_interfaces_only no_smart_pointers high_property_prefixes("_get","_put","_putref")

then you can say:

CComPtr<mscorlib::IAppDomainSetup> pAppDomainSetup;

Ta da!

Skip to main content