OK, I inserted the following code in the class that is exposed as COM object and it seems to work:
[ComRegisterFunction]
private static void Register(Type registerType)
{
if (registerType != null)
{
using (RegistryKey clsidKey = Registry.ClassesRoot.OpenSubKey("CLSID"))
{
using (RegistryKey guidKey = clsidKey.OpenSubKey(registerType.GUID.ToString("B"), true))
{
using (RegistryKey inproc = guidKey.OpenSubKey("InprocServer32", true))
{
inproc.SetValue("ThreadingModel", "Apartment", RegistryValueKind.String);
}
}
}
}
}
I don't understand at all, why changing the ThreadingModel by hand didn't yield the same result, but I don't care...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…