How to show installer to the user

2019-08-14 04:49发布

When the user clicks update on my application, I want to show the installer. The installer resides on a server.

What is the best way to show msi or installer to the user?

Is there any example?

Thanks

2条回答
Juvenile、少年°
2楼-- · 2019-08-14 05:25

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
查看更多
一夜七次
3楼-- · 2019-08-14 05:49

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.

查看更多
登录 后发表回答