title: Auto Increment version of setup project
body: <p>I need to increment version of an installer on every successful build. I have added a VBscript file and called it from a pre-build event. But am not able to get the actual result. my script is as under:</p>
  
  <pre><code>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) &amp; ".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 &amp; " --&gt; " &amp; vnew
  s = re.replace(s, "$1" &amp; vnew &amp; """")
  
  'replace ProductCode
  re.pattern = "(""ProductCode"" = ""8:)(\{.+\})"""
  guid = CreateObject("Scriptlet.TypeLib").Guid
  guid = left(guid, len(guid) - 2)
  s = re.replace(s, "$1" &amp; guid &amp; """")
  
  'replace PackageCode
  re.pattern = "(""PackageCode"" = ""8:)(\{.+\})"""
  guid = CreateObject("Scriptlet.TypeLib").Guid
  guid = left(guid, len(guid) - 2)
  s = re.replace(s, "$1" &amp; guid &amp; """")
  
  'write project file
  fnew = a(0)
  set f = fso.CreateTextfile(fnew, true)
  f.write(s)
  f.close
  </code></pre>
  
  <p>and my Pre-build Event is as C:\Projects\VersionProject\myscript.vbs "$(ProjectDir)VersionProject.Installer.vdproj" .Any help appreciated.</p>