How can I set a type's Guid dynamically?
Silly question, but I have an interface that is the exact same across several third-party COM Objects, but has a different GUID in each.
I have a C# interface that looks like so.
[Guid("1F13D3D8-3071-4125-8011-900D2EAC9A7F")]
[InterfaceType(2)]
[TypeLibType(4240)]
public interface UICtrl
{
//stuff
}
I want to be able to change the GUID dynamically at run time depending on which COM object the user chooses to load. I can't change the meta data, and Type.Guid has no set property. Any ideas?
I can't use Remit.Emit because the calling assembly doesn't use it. I'm really stuck!
So I ended up fixing this by using a part of @SLaks's answer and my own. Basically I took my parent interface and generated a child interface from it which had the GUID I wanted.