Solved

Create an uninstall shortcut in my Visual Studio 2005 setup project

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get id from json Data with NewtonSoft 3 34
How to tell the version of visual studio used for a certain project. 3 24
Error in script 11 47
Vb. Net application freezes 9 30
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 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

14 Experts available now in Live!

Get 1:1 Help Now