Tim Hibbard

CEO for EnGraph software
posts - 629 , comments - 1687 , trackbacks - 459

My Links

News



Add to Google

Twitter












Tag Cloud

Article Categories

Archives

Post Categories

Image Galleries

EnGraph Blogs

Links

Other

Roll

C# Code to install MSI silently and know when it is done

If you want to install an application that is packaged as an .MSI and you want to know when the application has finished installing, use this code:

string installerFilePath; installerFilePath = "C:\\Program Files\\CCS\\Downloads\\CCSRPTSetup.msi"; System.Diagnostics.Process installerProcess; installerProcess = System.Diagnostics.Process.Start(installerFilePath, "/q"); while (installerProcess.HasExited==false) { //indicate progress to user Application.DoEvents(); System.Threading.Thread.Sleep(250); } MessageBox.Show("done installing");

Technorati tags: ,

Print | posted on Thursday, December 28, 2006 10:39 AM | Filed Under [ .NET ]

Feedback

Gravatar

# re: C# Code to install MSI silently and know when it is done

A more elegant approach would be to trap the Process.Exited event.
12/30/2006 9:09 AM | Anthony Trudeau
Gravatar

# re: C# Code to install MSI silently and know when it is done

And if you need a synchronous approach, you can use Process.WaitForExit().
12/30/2006 9:11 AM | Anthony Trudeau
Gravatar

# re: C# Code to install MSI silently and know when it is done

I could have used .Exited, but that would have required setting up an event listener. I wanted to show a simple example.
.WaitForExit also works, but I wanted to be able to show how to easily give feedback to the user.
Obviously, a production version of this code would look a bit different, but it works for an example.
1/2/2007 8:50 AM | Tim Hibbard
Gravatar

# re: C# Code to install MSI silently and know when it is done

hi,how R u?
i want convert my code in c# language in visual studio to a program for installing to windows.
CanYouHelpMe?
8/20/2007 2:44 AM | pedram
Gravatar

# re: C# Code to install MSI silently and know when it is done

Hi,

actually MSI has ben successfully installed.that is fine Apart from it i want to show the complete process of installation like as we installed a set up.
please tell me ASAP
11/19/2008 6:24 AM | surender
Gravatar

# re: C# Code to install MSI silently and know when it is done

Hi,

Thats good.
But what will be c# code to uninstall the .msi setup same?
becoz if parent .msi is running your c# code.it install child .msi.
But when parent uninstall himself ,child remain their .
need your input on this.

5/7/2009 5:04 AM | Sharik
Gravatar

# re: C# Code to install MSI silently and know when it is done

/x parameter or /uninstall (for .exe or msi). You can also use "msiexec /x {12345-789-45612}" with product GUID in { }
12/17/2010 6:41 AM | Bartlomiej Chojnacki
Gravatar

# re: C# Code to install MSI silently and know when it is done

wqant code for installing via msi at remote machine..plz help me out for that source code..
12/19/2011 4:32 AM | jaymin
Gravatar

# re: C# Code to install MSI silently and know when it is done

Hi,

How to code for uninstall MSI Silently??
6/6/2012 10:08 AM | Andres
Gravatar

# re: C# Code to install MSI silently and know when it is done

Give me sample,for the same to remote domain machine.
1/13/2014 3:34 AM | Raja
Post A Comment
Title:
Name:
Email:
Comment:
Verification:
 

Powered by: