如何使用 Visual Studio 安装程序项目扩展创建升级安装程序
How to create an Upgrade installer with the Visual Studio Installer Projects extension
我在 the deployment projects QNA
上问过这个问题
I'm using the Microsoft Visual Studio Installer Projects extension to build a new installer for an update to a 10 year old project, but I cannot seem to create an installer that doesn't require the old version to be removed first.
I'm using VS 2019: if I choose "Install" from the project deployment menu then the new version is installed locally, but if I build it and run the MSI then I get "Another version of this program is already installed…" and will I have to ask my customer to uninstall and reinstall the app. Which they won't like.
I've updated the AssemblyFileVersion and AssemblyVersion properties in the output assembly, but this doesn't help.
So how do I create an update installer? There is no "Publish" menu option on the deployment project, and "Publish" is unavailable on the main menu for the project. The old way would have been to update the product code, but I cannot find a way to do that now in the interface.
I've tried manually changing the product code and package code in the .vdproj file - which lets the installer run, but it won't install because it says a newer version is installed: I've tried generating new GUIDs and manually updating the existing ones, but without success.
答案是:
In addition to the changes you made (updating the AssemblyFileVersion and AssemblyVersion properties in the output assembly) you also need to update the version of the setup project.
- Select the setup project in solution explorer and hit F4 to bring up the properties
- Increase "Version"
- Say yes to the dialog that comes up asking if you want to update the Product Code
- Save and build the setup project again.
This will enable the upgrade scenario.
这确实有效。我在此处添加它的原因是 F4 未在 .vdproj 上下文菜单中列出,因此实际上无法发现它。
还有一个怪癖:如果您正在使用 Git,那么出于某种原因它不会自动检出部署项目文件,所以您有手动编辑它(添加 space 就足够了)并重新加载项目,然后进行更改,无论如何都会重写项目。
我在 the deployment projects QNA
上问过这个问题I'm using the Microsoft Visual Studio Installer Projects extension to build a new installer for an update to a 10 year old project, but I cannot seem to create an installer that doesn't require the old version to be removed first.
I'm using VS 2019: if I choose "Install" from the project deployment menu then the new version is installed locally, but if I build it and run the MSI then I get "Another version of this program is already installed…" and will I have to ask my customer to uninstall and reinstall the app. Which they won't like.
I've updated the AssemblyFileVersion and AssemblyVersion properties in the output assembly, but this doesn't help.
So how do I create an update installer? There is no "Publish" menu option on the deployment project, and "Publish" is unavailable on the main menu for the project. The old way would have been to update the product code, but I cannot find a way to do that now in the interface.
I've tried manually changing the product code and package code in the .vdproj file - which lets the installer run, but it won't install because it says a newer version is installed: I've tried generating new GUIDs and manually updating the existing ones, but without success.
答案是:
In addition to the changes you made (updating the AssemblyFileVersion and AssemblyVersion properties in the output assembly) you also need to update the version of the setup project.
- Select the setup project in solution explorer and hit F4 to bring up the properties
- Increase "Version"
- Say yes to the dialog that comes up asking if you want to update the Product Code
- Save and build the setup project again.
This will enable the upgrade scenario.
这确实有效。我在此处添加它的原因是 F4 未在 .vdproj 上下文菜单中列出,因此实际上无法发现它。
还有一个怪癖:如果您正在使用 Git,那么出于某种原因它不会自动检出部署项目文件,所以您有手动编辑它(添加 space 就足够了)并重新加载项目,然后进行更改,无论如何都会重写项目。