【问题标题】:AppVeyor's .NET Core .csproj patching does not have any affectAppVeyor 的 .NET Core .csproj 补丁没有任何影响
【发布时间】:2018-09-23 10:29:42
【问题描述】:

这个周末我开始玩 AppVeyor。在我解决了一些其他问题之后,我目前卡在版本补丁中。

我想要达到的目标: 我正常的 master 分支应该像 1.0.{build} 这样的版本,它工作正常。但是当涉及到 dev 分支时,每个构建(或者说是 nuget 包)都应该包含类似“-alpha”后缀的东西。

这是我目前的Appveyor.xml。它目前已提交到我的 dev-Branch 的根目录,master 分支目前没有 xml,我想先解决这个问题。

version: 1.0.{build}
image: Visual Studio 2017
configuration: Release
platform: Any CPU
dotnet_csproj:
  patch: true
  file: '**\*.csproj'
  version: '{version}'
  package_version: '{version}'
  assembly_version: '{version}'
  file_version: '{build}'
  informational_version: '{version}'
before_build:
- cmd: dotnet restore Kinoheld.Api.Client\Kinoheld.Api.Client.sln
build:
  verbosity: minimal
after_build:
- cmd: dotnet pack Kinoheld.Api.Client\Kinoheld.Api.Client\Kinoheld.Api.Client.csproj
artifacts:
- path: '**\*.nupkg'
deploy: off

for:
-
  branches:
    only:
      - dev

  dotnet_csproj:
    patch: true
    file: '**\*.csproj'
    version: '{version}-alpha'
    package_version: '{version}-alpha'
    assembly_version: '{version}'
    file_version: '{version}'
    informational_version: '{version} (pre-release)'

为什么我的项目没有得到修补?好吧,我不知道他们是否真的没有打补丁,但为什么最终结果是我的 dev-builds 包没有我上面指定的版本?有什么我想念的吗?也许在我的 csproj 文件或类似的东西中?

你可以在这里找到我的项目 dev-branch - https://github.com/janniksam/Kinoheld/tree/dev - 如果您需要比上述 xml 更多的信息,请随时查看。

更新:\

如果您想知道:我确实没有设置了“忽略 appveyor.yml”。我在控制台中看到了Patching .NET Core .csproj files 行。

【问题讨论】:

  • 仅仅为了指定版本信息而给项目文件打补丁是不是有点奇怪?您不能执行自定义构建步骤来生成包含所需信息的文件吗?

标签: .net-standard appveyor


【解决方案1】:

我终于找到了解决办法。在查找项目时,Appveyor 在您的项目中搜索属性<Version>。我的项目没有声明 <Version>

【讨论】:

  • 正确this is an issue 描述它。我们仍然不确定是否应该创建这些属性,因为有些人会觉得这很麻烦。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-08-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-06-17
相关资源
最近更新 更多