【问题标题】:Team city vs-2017 Build versionTeam city vs-2017 Build版
【发布时间】:2017-03-15 22:57:51
【问题描述】:

如何在VS2017中设置dotnet core项目的构建版本?

是通过powershell的构建步骤在.csproj文件中包含version标签还是有更好的方法?

【问题讨论】:

    标签: teamcity .net-core visual-studio-2017


    【解决方案1】:

    我使用以下脚本创建了一个 PowerShell 构建步骤并且工作正常:

    $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)
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-20
      • 1970-01-01
      • 1970-01-01
      • 2014-03-17
      • 2013-03-31
      • 2018-08-18
      • 1970-01-01
      • 2013-11-27
      相关资源
      最近更新 更多