简体   繁体   English

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

[英]What is the syntax to use part of the version from CSPROJ and AppVeyor {build} to get a 2.0.x style build number?

Is it possible to have AppVeyor builds use the build number from the csproj file but replace the 'patch' version with the {build} variable? 是否可以让AppVeyor构建使用csproj文件中的构建号,但将{build} patch“版本替换为{build}变量?

For Example: 例如:

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)

Is this possible with the build-in AppVeyor Patching system? 内置的AppVeyor修补系统可以做到吗?

This should work. 这应该工作。 Just replace subfolder and file name in $xmlPath 只需替换$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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM