Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Create an uninstall shortcut in my Visual Studio 2005 setup project

Posted on 2009-05-12
4
Medium Priority
?
756 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
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Vadim Rapp earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month12 days, 12 hours left to enroll

972 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