开发者

How to show installer to the user

开发者 https://www.devze.com 2023-04-03 02:43 出处:网络
When the user clicks update on my application, I want to show the installer. The installer resides on a serve开发者_运维问答r.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消