问题描述
我创建一个安装项目并安装在Windows系统中.在安装安装项目之前,我将设置设置为
I create a setup project and installed in a windows system. Before going to install setup project I made setting as
DetectNewInstallerVersion = true
和
RemovePreviousVersion = True
我每次也都更改了版本.但是,如果我重建安装项目,然后再次安装msi文件,它将不会覆盖现有文件,而且会在程序功能中创建一个新的应用程序.我想卸载以前的版本并安装新版本,而无需手动卸载.
I have also changed the version every time. But If I rebuild the setup project then again install the msi file it will not overwrite the existing file also it will create a new application in program features. I want to uninstall the previous version and install new version without uninstall manually.
推荐答案
经过几次尝试和尝试,即使通过阅读该社区的回复,我也会尝试为您提供比我发现的更完整的答案.
After several trials and attempts, even by reading the replies of this community, I try to give you a more complete answer than I have found.
1)右键点击您的解决方案项目,然后点击属性.在 Application 菜单中,请记住Framework的版本(安装程序必须具有相同的版本),然后单击 Assembly Information .在这里,使用前三个代码块编写自定义版本(程序集版本和文件版本应该相同)(因为setup属性没有第四个代码块),例如1.0.0.
1) Right click on your solution project, then Properties. In the Application menù keep in mind the version of the Framework (the setup must have the same version) and then click Assembly Information. In here, write your custom version (Assembly Version and File Version should be identical) using the first three blocks (because the setup property doesn't have the fourth block), for example 1.0.0.
2)在 Explore Solutions 面板的 Detected Dependencies 文件夹中,在安装项目的树形视图中输入,然后双击 Microsoft .NET Framework 并设置
2) In the Explore Solutions panel enter inside the treeview of your setup project in the Detected Dependencies folder, then double click in Microsoft .NET Framework and set
Version = .NET Framework (X.X.X)
其中 X.X.X 是解决方案项目中使用的Framework的版本号.
where X.X.X is the version number of the Framework used in the solution project.
3)右键点击您的项目解决方案,然后点击属性.设置:
3) Right click on your project solution, then Properties. Set:
DetectNewerInstalledVersion = True
RemovePreviousVersions = True
Version = //the number used in the assembly at the point 1)
将出现消息如果更改版本,建议更改ProductCode.您要这样做吗?单击是.
4)右键单击您的项目解决方案,然后重新编译.如果 Output 面板未报告任何错误,则可以进入调试文件夹(通常为 C:\ Users \ YOURPCNAME \ Documents \ Visual Studio 2017 \ Projects \ YOURPROJECTNAME \ YOURPROJECTNAME \ bin\ Debug ),然后使用.msi或.exe文件安装项目.
4) Right click on your project solution, then Recompile. If the Output panel doesn't reports any errors, you can go in the debug folder (usually C:\Users\YOURPCNAME\Documents\Visual Studio 2017\Projects\YOURPROJECTNAME\YOURPROJECTNAME\bin\Debug) and use the .msi or the .exe files to install your project.
当您需要更改版本号时,请再次运行上面的四点.我在项目中使用此模式,并且.msi文件始终有效.
When you need to change the version number, run the four points above again.I use this mode for my projects and with .msi file has always worked.
这篇关于卸载先前版本的已安装的安装项目的新版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!