Link to home
Start Free TrialLog in
Avatar of JulienVan
JulienVanFlag for France

asked on

Create an uninstall shortcut in my Visual Studio 2005 setup project

Hi,

I'd like to add a shortcut in the start menu to uninstall my application, which is created with Visual Studio 2005.
I've heard about creating a .bat file with the uninstall command and the product code of my application, but it changes regularly when I update the version number.

Would you know if there are other ways to do that in a Visual Studio 2005 setup project?

I was thinking about creating a custom action to add the product code to the .bat file when my application is installed...
ASKER CERTIFIED SOLUTION
Avatar of Vadim Rapp
Vadim Rapp
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JulienVan

ASKER

Thanks, that's a very good idea, I'll try it and get back to you!
Hi, sorry for the delay, I finally used another solution getting from following link: http://www.codeproject.com/KB/dotnet/youruninstaller.aspx?msg=3185035#xx3185035xx

I created a new C# application with following code, then added it to my setup project, and created a shortcut to it with [ProductCode] as argument.
       static void Main()
        {
            string[] args = Environment.GetCommandLineArgs();
            if (args.Length > 1)
            {
                System.Diagnostics.Process.Start(Environment.SystemDirectory+"\\MsiExec.exe","/x"+args[1]);
                Application.Exit();
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }
        } 

Open in new window