开发者

Is there a way to ensure an MSI installer updates the .exe file every time?

Is there some easy, hassle-free way to get the MSI installation to always replace the .exe file (i.e. Primary Output) whenever the .exe file is more recent?

This is just basic and common sense. Wherever I search there are always complicated discussions about major and minor versions and patches. There must be some simple way to ensure the file gets re开发者_StackOverflow社区placed during an install. Otherwise, what is the MSI file actually doing during the whole installation procedure. It's like a fake install where nothing actually gets replaced/updated/upgraded.

What am I missing?


Everything works in a "common sense" way as long as you increment the version number of the .exe. MSI trusts version info over more malleable aspects like a file's timestamp.


I am using Visual Studio 2019 with 'Microsoft Visual Studio Installer Projects' and deploying a Windows Forms application.

To do what you ask -

  1. Increase the version number in the properties window for the installer project, it has 3 digits. A popup will appear asking about changing a product code, always choose yes.

Also in the same place, ensure that properties - 'DetectNewerInstalledVersion' is set to true and 'RemovePreviousVersions' is true

  1. Increase the version numbers (there are four digits but apparently you need to increase one of the first three) at the end of the 'AssemblyInfo.cs' file in Solution Explorer in the 'properties' sub-folder of the project for each project where you need the compiled files to be updated. If you don't do this the new version will appear to install correctly but the old unchanged files may remain.

Provided all this is done, when a user installs it, the old version will be updated to the new version without having the uninstall the old version manually.


In File table you can set the Version column to "65535.65535.65535.65535". This way the file will always be overwritten, no matter what version it actually has.

This is not supported by Visual Studio, but you can edit the MSI with Orca.


Set your assembly version of your project to 1.0.* then it will automatically produce a new .exe version. You also need to make sure you increase the setup version, sadly there isn't a way to get this to auto-increment.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜