Click here to Skip to main content
15,904,416 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
how to unregistered dll file using regasm by c# code
i want to make program to unregistered dll file using C#
Posted
Comments
OriginalGriff 5-May-14 5:02am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.
Sanket Saxena 5-May-14 5:59am    
where is your code? What you have tried so far dear?

Use RegistrationServices. See follwing code fragment. It does Show Register and unregister.

RegistrationServices regAsm = new RegistrationServices();
            String currentDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
            String assemblyFullName = currentDir + "\\" + xAssemblyName;
            Assembly assembly = null;

            // Register
            if (File.Exists(xAssemblyName))
            {
                AssemblyRegistrationFlags   flags= AssemblyRegistrationFlags.SetCodeBase;

                try
                {

                    assembly = System.Reflection.Assembly.LoadFile(assemblyFullName);
                }
                catch(Exception Excpt)
                {
                    assembly = null;
                    Console.WriteLine("Loading assembly failed. Message= " + Excpt.Message);
                }


                if (assembly != null)
                {
                    try
                    {
                        if (xOption.ToLower() == "/u")
                        {
                            // Unregister
                            if (regAsm.UnregisterAssembly(assembly))
                                Console.WriteLine("Successfully unregistered");
                            else
                                Console.WriteLine("Unregister failed");
                        }
                        else
                        {
                            // Register
                            if (regAsm.RegisterAssembly(assembly, flags))
                                Console.WriteLine("Successfully registered " + xAssemblyName);
                            else
                                Console.WriteLine("Registration failed");
                        }
                    }
                    catch (Exception Excpt)
                    {
                        Console.WriteLine("Registering/Unregistering assembly failed. Message= ");
                        Console.WriteLine(Excpt.Message);
                        Console.WriteLine();
                        Console.WriteLine("Most likely you do not have administrator rights.");
                    }
                }

            }
            else
            {
                Console.WriteLine("File does not exist: " + xAssemblyName);
                Console.WriteLine();
                DisplayHelp();
            }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900