Solved

Create an uninstall shortcut in my Visual Studio 2005 setup project

Posted on 2009-05-12
4
753 Views
Last Modified: 2013-11-26
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...
0
Comment
Question by:JulienVan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Vadim Rapp earned 500 total points
ID: 24370263
specify product code as [ProductCode] .

.bat file is not very nice solution, since it will show black command prompt window. Better create vbscript doing the same. Or you can compile fake msiexec.exe with version 1.0 and include it in your project and specify that it should go into SystemFolder (which you add to the setup project as special folder), then create shortcut to it with arguments /x [ProductCode]. The installation will skip copying of your fake Msiexec anyways because its version is lower than of the real one, but will create the shortcut.
0
 
LVL 2

Author Comment

by:JulienVan
ID: 24372025
Thanks, that's a very good idea, I'll try it and get back to you!
0
 
LVL 2

Author Comment

by:JulienVan
ID: 25259213
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

0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Why use this lambda? 12 65
Unlocking a column in excel using C# 17 28
c#, datatable, aspx 4 23
vb.net application has warrnings about VB6 calls. 2 17
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question