How to make the msi overwrite program if a previous version exist?

给你一囗甜甜゛ 提交于 2019-12-10 15:42:41

问题


I am using Visual Studio 2010, I am working on a windows application and while trying to make an automatic updater for it faced a serious problem.

When the program find a new version and trying to install it, it couldn't because of two reasons:

1- the application is exist in my program files. so that window appears

2- the application is already opened "the form that performed the update process".

The problem doesn't have any relation with the version number.

It's about the program existence and the ability to install a new version although the previous version is opened.


回答1:


To enable the automated major upgrade mechanism you need to increase the ProductVersion and change the ProductCode. This is done through the project Properties pane.

You can read more about upgrades here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa370579(v=vs.85).aspx




回答2:


Cosmin is correct, but if you want more specific steps, try following the steps outlined in this other Stack Overflow post:

  • How do I ensure my winform application deployment overwrites old versions?



回答3:


If you are looking to update an existing program this is known as patching so you don't need to use an MSI which is an installer, instead please look into MSP instead of MSI.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa370578(v=vs.85).aspx

For us - we have used a loading screen and hooked up to a SQL table which posses a list of relevant .DLL's in binary. I then use reflection to check the version number compared to the one in the start up directory and if it is newer then replace it - That's just another idea but if you are looking at updating exisiting software with a package of some sort, take a look into MSP's.



来源:https://stackoverflow.com/questions/12211193/how-to-make-the-msi-overwrite-program-if-a-previous-version-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!