代码之家  ›  专栏  ›  技术社区  ›  Nate CSS Guy

使用CSPROJ和AppVeyor{build}中的部分版本获取2.0.x样式的内部版本号的语法是什么?

  •  0
  • Nate CSS Guy  · 技术社区  · 7 年前

    是否可以让AppVeyor版本使用csproj文件中的版本号,但将“补丁”版本替换为 {build} 变数?

    CSPROJ: <Version>2.1.0</Version>
    AppVeyor: ??? What goes here? Manually setting 2.1.{build} will work but then to rev to 2.2, we have to update appveyor AND csproj.
    Output: 2.1.15 (assuming build number is 15)
    

    内置AppVeyor修补系统是否可以做到这一点?

    1 回复  |  直到 7 年前
        1
  •  1
  •   Ilya Finkelsheyn    7 年前

    这应该管用。只需替换中的子文件夹和文件名 $xmlPath

    install:
    - ps: |
        $xmlPath = "$env:appveyor_build_folder\mysubfolder\myproject.csproj"
        $xml = [xml](get-content $xmlPath)
        $version = ($xml.Project.PropertyGroup | ? {$_.Version}).Version
        $env:newversion = ($version.Substring(0, $version.LastIndexOf(".") + 1)) + $env:appveyor_build_number
    
    dotnet_csproj:
      patch: true
      file: '**\*.csproj'
      version: $(newversion)
      package_version: $(newversion)
      assembly_version: $(newversion)
      file_version: $(newversion)
      informational_version: $(newversion)