Team City vs-2017 Build版本 [英] Team city vs-2017 Build version
本文介绍了Team City vs-2017 Build版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在VS2017中的dotnet核心项目上设置构建版本?
How can I set the build version on dotnet core projects in VS2017?
是否通过powershell上的构建步骤包含了版本
标记还是有更好的方法?
Is it through a build step over powershell to include the the version
tag on .csproj file or is there a better way?
推荐答案
我已经创建了一个PowerShell Build步骤使用以下脚本运行良好:
I've created a PowerShell Build Step with the following script and worked fine:
$newBuildNumber = "%build.number%"
$files = Get-ChildItem -Path "*.csproj" -Recurse
foreach( $file in $files ) {
Write-Host "Processing: " $file.Name
$info = [xml] (Get-Content $file)
if($info.Project.PropertyGroup.Version){
$info.Project.PropertyGroup.Version = $newBuildNumber
}
else {
$newChild = $info.CreateElement("Version")
$newChild.set_InnerXml($newBuildNumber)
$info.Project.PropertyGroup.AppendChild($newChild)
}
$info.Save($file)
}
这篇关于Team City vs-2017 Build版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文