?
Solved

Uninstaller comes second

Posted on 2006-11-29
3
Medium Priority
?
200 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 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