private void EnsureManagedCategoryExists() { if (RegistrationServices.ManagedCategoryExists()) { return; } using (RegistryKey subKey1 = Registry.ClassesRoot.CreateSubKey("Component Categories")) { using (RegistryKey subKey2 = subKey1.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}")) subKey2.SetValue("0", (object)".NET Category"); } }