When the user clicks update on my application, I want to show the installer. The installer resides on a serve开发者_运维问答r.
What is the best way to show msi or installer to the user?
Is there any example?
Thanks
First of all you need to copy your installation package to the client. You can transfer binary data or download using WebClient
.
Then you can execute the installation package using Process.Start
and msiexec
utility
msiexec /quiet /i "c:\myinstallationpackage.msi" // for hidden installation
msiexec /qb /i "c:\myinstallationpackage.msi" // for installation with base steps without any actions from the user
msiexec /i "c:\myinstallationpackage.msi" // usual installation
After you download the msi file, you just run it using the Process class found in System.Diagnostics namespace.
Windows will take care after that.
LATER EDIT: Sample code:
Process.Start(@"C:\install.msi", string.Empty);
Of course the path to your downloaded .msi file should point to a temporary directory (a good choice would be the Windows temporary folder itself), but the idea is to get to call the static method Start() of the Process class.
精彩评论