是否有一种方法可以自动增加VS2013安装程序项目的版本号?



我们目前配置了几个VS2013安装/安装项目,需要转移到自动部署过程。

因此需要的一件事是安装程序的自动递增版本号(msi)。

在VS2013中有办法做到这一点吗?我们使用TeamCity进行构建和部署,使用git进行源代码控制。

我知道有其他的包(例如Wix)已经支持这个了,但是如果我们能坚持使用VS2013,那对我们来说是最好的。

你可以使用vs扩展-自动版本递增器:

https://visualstudiogallery.msdn.microsoft.com/e30465a4 dab9 - 44 - ca - 815 b - b390ceeef6ab

更新:所请求的可以通过以下文章实现:http://www.codeproject.com/Articles/22256/NewSetupVersion-for-MSI-Projects

和其中描述的脚本:

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''  Increment the version number of an MSI setup project
''  and update relevant GUIDs
''  
''  Hans-Jürgen Schmidt / 19.12.2007  
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
set a = wscript.arguments
if a.count = 0 then wscript.quit 1
'read and backup project file
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(a(0))
s = f.ReadAll
f.Close
fbak = a(0) & ".bak"
if fso.fileexists(fbak) then fso.deletefile fbak
fso.movefile a(0), fbak
'find, increment and replace version number
set re = new regexp
re.global = true
re.pattern = "(""ProductVersion"" = ""8:)(d+(.d+)+)"""
set m = re.execute(s)
v = m(0).submatches(1)
v1 = split(v, ".")
v1(ubound(v1)) = v1(ubound(v1)) + 1
vnew = join(v1, ".")
'msgbox v & " --> " & vnew
s = re.replace(s, "$1" & vnew & """")
'replace ProductCode
re.pattern = "(""ProductCode"" = ""8:)({.+})"""
guid = CreateObject("Scriptlet.TypeLib").Guid
guid = left(guid, len(guid) - 2)
s = re.replace(s, "$1" & guid & """")
'replace PackageCode
re.pattern = "(""PackageCode"" = ""8:)({.+})"""
guid = CreateObject("Scriptlet.TypeLib").Guid
guid = left(guid, len(guid) - 2)
s = re.replace(s, "$1" & guid & """")
'write project file
fnew = a(0)
set f = fso.CreateTextfile(fnew, true)
f.write(s)
f.close

最新更新