[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Uninstaller comes second

Posted on 2006-11-29
3
Medium Priority
?
201 Views
Last Modified: 2010-04-16
I have followed this article http://www.codeproject.com/useritems/DeployUninstall.asp and created uninstaller for my setup project. However, I have translated it into C# from VB.net

my code is like this:

            [STAThread]
            static void Main()
            {

                  string[] arguments = Environment.GetCommandLineArgs();

                  foreach(string argument in arguments)
                  {
                        string[] parameters = argument.Split('=');
                        if (parameters[0].ToLower() == "/u")
                        {
                              string productCode = parameters[1];
                              string path = Environment.GetFolderPath(Environment.SpecialFolder.System);
                              Process proc = new Process();
                              proc.StartInfo.FileName = string.Concat(path,"\\msiexec.exe");
                              proc.StartInfo.Arguments = string.Concat(" /i ", productCode);
                              proc.Start();
                              Application.Exit();
                        }
                  }

                  Application.Run(new Form1());
            }

The uninstaller works ok and it unistalls my project. Only once issue here is that when I click uninstaller, it starts the application first and the uninstallation window comes second.  I have put "Application.Run(new Form1());" code at last line (after uninstallation code), why it is still be executed? What can I do to avoid start the project and only uninstall it?

Thanks a lots!
0
Comment
Question by:boy8964
[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
3 Comments
 
LVL 2

Expert Comment

by:BogdyPtr
ID: 18043530
Remove Application.Run(new Form1());
In this way the uninstaller will be started and no form will be shown.
0
 
LVL 4

Author Comment

by:boy8964
ID: 18048779
if I remove Application.Run(new Form1()); my application wot start!
0
 
LVL 3

Accepted Solution

by:
bvwang earned 2000 total points
ID: 18081834
if (arguments == 1) {
Application.Run(new Form1());
}
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
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, …
Suggested Courses

656 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