【问题标题】:Problem related to cloud build azure pipelines yaml(Azure devops)与云构建 azure 管道 yaml(Azure devops) 相关的问题
【发布时间】:2023-01-11 13:43:36
【问题描述】:

我在 yml 文件中使用 dotnet pack 命令将代码打包到 NuGet 包中。

当 pack 命令在管道中运行时,它说: 已成功创建包 'E:\agentname....\45\a\Ayush.search.0.0.4.nupkg' 当 push 命令起作用时,它说文件不存在 E:\代理名....\45\a/Ayush.search.0.0.4.nupkg。 可以通过更改脚本中的斜杠来解决运行问题 - dotnet nuget push $(BUILD.STAGINGDIRECTORY)\ 但对于云构建,需要正斜杠。

我在 yml 文件中使用 dotnet pack 命令将代码打包到 NuGet 包中。

-脚本:| dotnet pack Ayush.search/Ayush.search/Ayush.search.csproj --version-suffix --configuration…… 我还使用了 dotnet nuget push 命令

-脚本:| dotnet nuget push $(BUILD.STAGINGDIRECTORY)/Ayush.Search.*.nupkg --source " " --api-key ...

当 pack 命令在管道中运行时,它说: 已成功创建包 'E:\agentname....\45\a\Ayush.search.0.0.4.nupkg' 当 push 命令起作用时,它说文件不存在 E:\代理名....\45\a/Ayush.search.0.0.4.nupkg。 可以通过更改斜杠 dotnet nuget push $(BUILD.STAGINGDIRECTORY)\ 来解决运行问题,但对于云构建,需要正斜杠。 怎样才能保留正斜杠并解决错误?

【问题讨论】:

  • 请考虑将代码和错误格式化为codecode block。这将使问题更具可读性。

标签: azure azure-devops azure-pipelines


【解决方案1】:

我想您可以使用 dotnet task 而不是脚本命令来执行操作。

pool:
  vmImage: ubuntu-latest

steps:
- task: DotNetCoreCLI@2
  inputs:
    command: 'pack'
    packagesToPack: '**/*.csproj'
    versioningScheme: 'off'

- task: DotNetCoreCLI@2
  inputs:
    command: 'push'
    packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
    nuGetFeedType: 'internal'
    publishVstsFeed: ''

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-05-14
    • 2021-01-21
    • 2019-02-18
    • 2019-04-06
    • 2019-08-04
    • 2020-05-23
    • 2022-11-03
    相关资源
    最近更新 更多