简体   繁体   中英

Escape spaces in azure-pipelines.yml for the dotnet publish command

I am getting the error message: " MSBUILD: error MSB1008: Only one project can be specified " when the dotnet publish command executes in Azure Pipelines presumably because my repository have spaces in the name, but I do not have permission to change the repo name.

The section of the azure-pipelines.yml with the dotnet publish command:

- task: DotNetCoreCLI@2
  displayName: 'dotnet publish'
  inputs:
    command: publish
    publishWebProjects: false
    projects: '**/My App Backend/*.csproj'
    arguments: '--configuration $(buildConfiguration) --output $(Build.
    ArtifactStagingDirectory)'

- task: PublishBuildArtifacts@1
  displayName: 'publish artifacts'

I have tried the following to escape the spaces in the repo name, without luck:

  • Replacing the spaces with %20.
  • Encapsulating the filepath with "\" on the start and end.

Is there another way to escape spaces that I am missing?

Escape spaces in azure-pipelines.yml for the dotnet publish command

I could reproduce this issue on my side if I create a project with escape spaces in the name.

To resolve this issue, please try to use double quotes for the argument --output "$(Build.ArtifactStagingDirectory)" :

- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish
    publishWebProjects: false
    projects: '**/My App Backend/*.csproj'
    arguments: '--configuration $(BuildConfiguration) --output "$(build.artifactstagingdirectory)"'

The test result:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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