English 中文(简体)
如何在利用微型信贷额度建造EXE时具体说明文件版本?
原标题:How to specify File Version when building EXE using MSBuild?

我试图利用MSBuild / Delphi 2010编辑一个EXE,我尝试这样做:

MSBuild.exe /t:Clean;Build /p:config=Release;ExtraDefines=“Code Test”/property:FileVersion=1.0.0.15 “D:My ProjectMyFile.dproj”

文件虽已建,但版本为t。

有什么错误?

最佳回答

贵族财产“FileVersion”可在MSBuild会议内查阅,但除非你有某种用途的任务或目标,否则就不被用于任何用途。 你们要么需要(正如DHeffernan所说)创建一种版本的资源,由你的代码使用,要么使用一种分离后的工具,将这一版本应用于你的外壳或 d。

StackOverflow article列出了一些工具,用于完成清理后的工作。

问题回答

Using VerInfo_Keys as an MSBuild property has worked for me. The rest of the assembly properties you want also need to be provided at the same time however.

msbuild.exe "D:MyProjectMyFile.dproj" /p:Config=Release /p:VerInfo_Keys="FileVersion=1.2.3.4;ProductVersion=1.2.3.4;LegalCopyright=Copyright © My Company;ProductName=My Product;CompanyName=My Company" /t:Clean;Build

这里的主要问题是,<代码>FileVersion“attribute”是《国际特别安全公约》清单的一部分。 VerInfo_Keys property but not a property se.

因此,我看到的解决办法是:

  1. Take VersInfo_Keys property (CSV-list)
  2. Split it to Key=Value pairs
  3. Change value of FileVersion=... pair
  4. Join list back to CSV-list.

I ve implemented , 载有 MSBuild Inline Task (N.B.: NET Framework 4.0 and above must be used):

  1. Put the gist (noticed above) to a libMSBuildTasksDelphi.VersionInfo.targets file (git submodule in my case)

  2. 添加到德尔菲项目档案中(saydelphi-project.dproj):

    <Import Project="libMSBuildTasksDelphi.VersionInfo.targets" Condition="$(FileVersion)!= and Exists( libMSBuildTasksDelphi.VersionInfo.targets )"/>

    condition "FileVersion is set" is to avoid failure in Delphi as the latter uses .NET 3.5 which does not support inline tasks (so, FileVersion is only set when 1 P-4, 1 P-3, 1 P-2 with MSBuild).

  3. 1 P-4, 1 P-3, 1 P-2

    msbuild delphi-project.dproj /t:build /p:FileVersion=A.B.C.D

我也使用安伯斯语(Delphi XE7/10/2007/5)。 Just VersionName and VersionC "properties” are used than FileVersion (N.B. Import s conditions is amended appropriate.

msbuild delphi-project.dproj /t:build /p:VersionName=A.B.C.D





相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签