使用MSBuild构建EXE时如何指定文件版本? [英] How to specify File Version when building EXE using MSBuild?

查看:79
本文介绍了使用MSBuild构建EXE时如何指定文件版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用MSBuild/Delphi 2010编译EXE,我尝试过:

I'm trying to compile an EXE using MSBuild / Delphi 2010, I tried this:

MSBuild.exe/t:Clean; Build/p:config = Release; ExtraDefines ="CodeTest"/property:FileVersion=1.0.0.15"D:\ MyProject \ MyFile.dproj"

MSBuild.exe /t:Clean;Build /p:config=Release;ExtraDefines="CodeTest" /property:FileVersion=1.0.0.15 "D:\MyProject\MyFile.dproj"

已构建文件,但未设置版本

File is built but version isn't set

到底怎么了?

推荐答案

您的属性"FileVersion"在MSBuild会话中可用,但是除非您有一个以某种方式使用它的Task或Target,否则它不会用于任何用途.您将需要(如DHeffernan所说)创建代码使用的版本资源,或使用后编译工具将版本信息应用于您的exe或dll.

Your property "FileVersion" is available inside the MSBuild session, but unless you have a Task or Target that uses it somehow, it's not being used for anything. You'll either need to (as DHeffernan says) create a version resource that your code uses or use a post-compile tool to apply the version info to your exe or dll.

这篇 StackOverflow文章列出了许多用于进行后编译的工具.

This StackOverflow article lists a number of tools to do the post-compile thing.

这篇关于使用MSBuild构建EXE时如何指定文件版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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