如何保持安装程序的版本号与安装的程序集的版本号同步? [英] How to keep the installer's version number in sync with the installed assemblies' version numbers?

查看:140
本文介绍了如何保持安装程序的版本号与安装的程序集的版本号同步?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我目前的项目中,我每周发行一次。我一直在使用这篇文章中描述的技术保持项目中所有程序集的版本号同步。 (我目前没有什么好的理由分别跟踪程序集的版本号,虽然我相信那一天最终会来。)

In my current project, I'm producing weekly releases. I've been using the technique described in this post to keep the version numbers of all of the assemblies in my project in sync. (I don't presently have any good reason to track the assemblies' version numbers separately, though I'm sure that day will eventually come.)

当我推出一个版本,我构建一个新版本的安装程序。与所有的程序集不同,它们可以从共享的SolutionInfo.cs文件中获取它们的版本号,安装程序的版本号最好不能说是一个程序集属性。所以我的发布过程包括在设置项目中手动提升版本号。

When I push out a release, I build a new version of the installer. Unlike all of the assemblies, which can get their version numbers from a shared SolutionInfo.cs file, the version number of the installer isn't, as best I can tell, an assembly property. So my release process includes manually advancing the version number in the setup project.

或者我应该说,通常包括这样做。我想把它变成我不能解决的东西。我发现设置和部署项目的文档是令人惊讶的不透明(如果用户将它安装到非默认路径,找出如何使MSI可以正确卸载是非常困难的一个非常有趣的常见用例是无证的),并且不知道是否有可能这样做。

Or, I should say, usually includes doing that. I'd like to turn that into something I can't screw up. I'm finding the documentation of setup and deployment projects to be surprisingly opaque (it was quite a bit harder to find out how to make it possible for the MSI to uninstall properly if the user installed it to a non-default path, which is a pretty freaking common use case to be undocumented) and have no idea if it's even possible to do this.

任何想法?

编辑:

只是为了澄清,这是一个Visual Studio安装和部署项目,我在说。 p>

Just to clarify, this is a Visual Studio setup and deployment project I'm talking about.

推荐答案

CodeProject有一个脚本来设置MSI文件的版本号,您可以在安装程序的预构建步骤中运行项目。你在这里找到:

CodeProject has a script to set the version number of an MSI file, which you could run in the pre-built step of the setup project. You find it here:


http://www.codeproject.com/KB/install/NewSetupVersion.aspx

更多详细信息

请注意,使用Windows Installer的情况有点复杂。 MSI文件(使用VS安装和部署项目创建的文件)不仅具有版本号,而且还包含GUID值的产品代码。此产品代码由Windows Installer用于唯一标识您的产品,例如在控制面板 - >添加或删除程序,您可以决定卸载或修复产品。

Be aware that with Windows Installer things are a bit more complicated. MSI files (as the one that you create using a VS Setup and Deployment project) not only have a version number but also a product code which is a GUID value. This product code is used by Windows Installer to uniquely identify your product e.g. in Control Panel -> Add Or Remove programs where you can decide to uninstall or repair a product.

但是,更改MSI版本号时,此产品代码也必须在一些情况下改变了。 MSI技术记录不良,但您可以在以下MSDN页面上更改产品代码,以查找一些建议: http://msdn.microsoft.com/en-us/library/aa367850(VS.85).aspx

However, when changing you MSI version number, this product code must also be changed in a number of cases. MSI technology is poorly documented but you can find some recommendations when to also change the product code on the following MSDN page: http://msdn.microsoft.com/en-us/library/aa367850(VS.85).aspx.

在我的项目中,我总是为每个新版本生成一个新的产品代码。 CodeProject上的脚本也会更改您的产品代码。

In my projects I always generate a new product code for every new version. The script on CodeProject will also change the product code for you.

还有一件事:Windows Installer仅检查版本号码的前三个位置,第四名将被忽略,即2.3.0.1234被认为等于2.3.0.5678。 ( ProductVersion

And one more thing: Windows Installer only checks the first three places of the version number afaik, anything in the forth place will be ignored, i.e. 2.3.0.1234 is considered equal to 2.3.0.5678. (ProductVersion)

(有一篇有关CodeProject的文章,可能也会对你有所帮助: http://www.codeproject.com/KB/install/VersionVDProj.aspx

(There is a related article on CodeProject which might also be interesting to you: http://www.codeproject.com/KB/install/VersionVDProj.aspx)

这篇关于如何保持安装程序的版本号与安装的程序集的版本号同步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆