我希望在每次构建和发布时对我的 DLL 进行版本化,因为我使用了 powershell 脚本:
foreach ($file in $files) {
$filecontent = Get-Content($file)
echo "updating version for $file"
attrib $file -r
$filecontent | %{$_ -replace 'AssemblyVersion\("[0-9]+?(\.([0-9]+?|\*)){1,3}"\)', $('AssemblyVersion("' + $NewVersion + '")') } |
%{$_ -replace 'AssemblyFileVersion\("[0-9]+?(\.([0-9]+?|\*)){1,3}"\)', $('AssemblyFileVersion("' + $NewVersion + '")') } |
%{$_ -replace '<AssemblyVersion>[0-9]+?(\.([0-9]+?|\*)){1,3}<', $('<AssemblyVersion>' + $NewVersion + '<') } |
%{$_ -replace '<FileVersion>[0-9]+?(\.([0-9]+?|\*)){1,3}<', $('<FileVersion>' + $NewVersion + '<') } |
%{$_ -replace '<Version>[0-9]+?(\.([0-9]+?|\*)){1,3}<', $('<Version>' + $NewVersion + '<') } | Out-File -Encoding "UTF8" $file
但早些时候我使用的是版本控制正常工作的天蓝色/本地构建服务器。
不,我切换到托管代理,Powershell 脚本任务运行成功,但 dll 版本保持为 1.0.0。
任何解决方案也可以在 Hotsed 代理上完成这项工作?