绑定WIX FileVersion子值?

l33*_*33t 8 wix

在WIX中,我可以这样做以自动为我的MSI生成一个合适的版本号:

<?define ProductVersion="!(bind.FileVersion.MyMainExecutable)" ?>
<Product Version="$(var.ProductVersion)" ... />
Run Code Online (Sandbox Code Playgroud)

这会产生一个像"1.0.1.0"这样的字符串,但我只想要前三个部分:"1.0.1"

我怎么能做到这一点?

Rob*_*ing 11

没有办法只获得绑定的前三个字段FileVersion.但是,如果您可以将四部分版本分配给Product/@Version(这是完全有效的,虽然主要升级只会查看前三个字段),然后您可以使用以下内容访问主要,次要,构建和修订的每个部分变量:

!(bind.property.ProductVersion.Major)
!(bind.property.ProductVersion.Minor)
!(bind.property.ProductVersion.Build)
!(bind.property.ProductVersion.Revision)
Run Code Online (Sandbox Code Playgroud)

希望这可能有用.

  • 所以我可以将我的安装程序的标题设置为这样的东西?`"我的安装程序v!(bind.property.ProductVersion.Major).!(bind.property.ProductVersion.Minor).!(bind.property.ProductVersion.Build)"` (2认同)