Solved

Create an uninstall shortcut in my Visual Studio 2005 setup project

Posted on 2009-05-12
4
742 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 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now