如何将TeamCity build版本导入非托管DLL和OCX控件?
我有一个TeamCity构建解决方案,包含托管(C#)和非托管(C++)项目。是否有类似于装配信息补丁的TeaTeCo实用程序,它将改变在非托管C++ DLL和OCX项目中的版本号以匹配生成号?< P>不,TeaStCARE没有任何更新C++ DLL版本的版本,但是您可以使用它来更新C++ DLL的版本。您需要下载exe并添加一个构建来调用exe,该版本将更新C++ exe或dll的版本。如何将TeamCity build版本导入非托管DLL和OCX控件?,dll,version,teamcity,ocx,Dll,Version,Teamcity,Ocx,我有一个TeamCity构建解决方案,包含托管(C#)和非托管(C++)项目。是否有类似于装配信息补丁的TeaTeCo实用程序,它将改变在非托管C++ DLL和OCX项目中的版本号以匹配生成号?< P>不,TeaStCARE没有任何更新C++ DLL版本的版本,但是您可以使用它来更新C++ DLL的版本。您需要下载exe并添加一个构建来调用exe,该版本将更新C++ exe或dll的版本。 这是我在PowerShell中使用的StampVer的替代方案,它在生成之前修改.rc文件。我对Stamp
这是我在PowerShell中使用的StampVer的替代方案,它在生成之前修改.rc文件。我对StampVer的限制感到不舒服,即预先用足够的空间填充版本字符串
#################################################################
#
# Patch all of the given *.rc files and set
# the version strings for DLLs and OCX controls.
#
#################################################################
# Hand parse the arguments so we can separate them with spaces.
$files = @()
$previousArg = "__"
foreach ($arg in $args)
{
if ($previousArg -eq "-version")
{
$version = $arg
}
elseif ($previousArg -eq "__")
{
}
else
{
$files += $arg
}
$previousArg = $arg
}
Function PatchRCFiles([string]$version, [string[]]$files)
{
# check the version number
if ( $version -match "[0-9]+.[0-9]+.[0-9]+.[0-9]+" )
{
echo "Patching all .rc files to version $version"
# convert the version number to .rc format
$rc_version = $version -replace "\.", ","
$rc_version_spaced = $version -replace "\.", ", "
# patch the files we found
ForEach ($file In $files)
{
echo "Processing $file..."
$content = (Get-Content $file)
$content |
Foreach-Object {
$_ -replace "^\s*FILEVERSION\s*[0-9]+,[0-9]+,[0-9]+,[0-9]+$", " FILEVERSION $rc_version" `
-replace "^\s*PRODUCTVERSION\s*[0-9]+,[0-9]+,[0-9]+,[0-9]+$", " PRODUCTVERSION $rc_version" `
-replace "(^\s*VALUE\s*`"FileVersion`",\s*)`"[0-9]+,\s*[0-9]+,\s*[0-9]+,\s*[0-9]+`"$", "`$1`"$rc_version_spaced`"" `
-replace "(^\s*VALUE\s*`"ProductVersion`",\s*)`"[0-9]+,\s*[0-9]+,\s*[0-9]+,\s*[0-9]+`"$", "`$1`"$rc_version_spaced`""
} |
Set-Content $file
}
}
else
{
echo "The version must have four numbers separated by periods, e.g. 5.4.2.123"
}
}
PatchRCFiles $version $files
TeamCity中的配置如下所示:
只需给脚本一个要调整的.rc文件列表。此步骤必须在主要构建步骤之前运行。我认为regex中的“FileVersion”和“ProductVersion”替换存在缺陷。在我的测试应用程序中,这两个属性具有以下形式:
值“FileVersion”,“1.0.0.1”
。您的正则表达式正在查找逗号分隔的数字,然后替换以空格分隔的版本号。我修改了表达式以查找“.”分隔的数字,并直接在版本参数中替换<代码>-替换“(^\s*VALUE\s*“FileVersion,\s*)
”[0-9]+。\s*[0-9]+。[s*[0-9]+。\s*[0-9]+“$”,“
$1“$version
”`此更改然后正确更新了文件版本和产品版本详细信息。