Cannot unregister assembly

E

Emmanuel

Hi,

Using Microsoft Visual Studio 2003, I have created an assembly that was
registered as COM component. On the project's options the "Register for COM
interop" option was checked. The assembly was compiling and working without
problems,

until I switched to VS 2005.

Now when I try to compile my project I get the message:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(845,9):
error MSB3395: Cannot unregister assembly "C:\PathToProject\MyProject.dll".
Exception has been thrown by the target of an invocation.
Done building project "MyProject.csproj" -- FAILED.

How can I unregister the assembly so that I can compile the project with VS
2005 ?

Please help.
Thanks

Emmanuel
 
E

Emmanuel

I forgot to say that I am registering using the following code:

[ComRegisterFunctionAttribute]
public static void RegisterFunction(Type t)
{
Microsoft.Win32.Registry.ClassesRoot.CreateSubKey("CLSID\\{" +
t.GUID.ToString().ToUpper() + "}\\Programmable");
Microsoft.Win32.RegistryKey key =
Microsoft.Win32.Registry.ClassesRoot.CreateSubKey(
"CLSID\\{" + t.GUID.ToString().ToUpper() + "}\\InprocServer32");
key.SetValue("", @"C:\Windows\System32\mscoree.dll");
}

[ComUnregisterFunctionAttribute]
public static void UnregisterFunction(Type t)
{
Microsoft.Win32.Registry.ClassesRoot.DeleteSubKey("CLSID\\{" +
t.GUID.ToString().ToUpper() + "}\\Programmable");
Microsoft.Win32.Registry.ClassesRoot.DeleteSubKey("CLSID\\{" +
t.GUID.ToString().ToUpper() + "}\\InprocServer32");
}


Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top