Geeks With Blogs

News



Add to Google

Tim Hibbard CEO for EnGraph software

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: ,
Posted on Thursday, December 28, 2006 10:39 AM .NET | Back to top


Comments on this post: C# Code to install MSI silently and know when it is done

# re: C# Code to install MSI silently and know when it is done
Requesting Gravatar...
A more elegant approach would be to trap the Process.Exited event.
Left by Anthony Trudeau on Dec 30, 2006 9:09 AM

# re: C# Code to install MSI silently and know when it is done
Requesting Gravatar...
And if you need a synchronous approach, you can use Process.WaitForExit().
Left by Anthony Trudeau on Dec 30, 2006 9:11 AM

# re: C# Code to install MSI silently and know when it is done
Requesting Gravatar...
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.
Left by Tim Hibbard on Jan 02, 2007 8:50 AM

# re: C# Code to install MSI silently and know when it is done
Requesting Gravatar...
hi,how R u?
i want convert my code in c# language in visual studio to a program for installing to windows.
CanYouHelpMe?
Left by pedram on Aug 20, 2007 2:44 AM

# re: C# Code to install MSI silently and know when it is done
Requesting Gravatar...
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
Left by surender on Nov 19, 2008 6:24 AM

# re: C# Code to install MSI silently and know when it is done
Requesting Gravatar...
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.

Left by Sharik on May 07, 2009 5:04 AM

# re: C# Code to install MSI silently and know when it is done
Requesting Gravatar...
/x parameter or /uninstall (for .exe or msi). You can also use "msiexec /x {12345-789-45612}" with product GUID in { }
Left by Bartlomiej Chojnacki on Dec 17, 2010 6:41 AM

# re: C# Code to install MSI silently and know when it is done
Requesting Gravatar...
wqant code for installing via msi at remote machine..plz help me out for that source code..
Left by jaymin on Dec 19, 2011 4:32 AM

# re: C# Code to install MSI silently and know when it is done
Requesting Gravatar...
Hi,

How to code for uninstall MSI Silently??
Left by Andres on Jun 06, 2012 10:08 AM

# re: C# Code to install MSI silently and know when it is done
Requesting Gravatar...
Give me sample,for the same to remote domain machine.
Left by Raja on Jan 13, 2014 3:34 AM

Your comment:
 (will show your gravatar)


Copyright © Tim Hibbard | Powered by: GeeksWithBlogs.net | Join free