Azure构建管道不起作用: unable to create directory D:\a\1\a\

标签 azure azure-pipelines

我正在学习 Azure DevOps,但我被构建管道所困扰。 该项目是一个简单的 .NET Core Web 应用程序,这是 YAML 文件

# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
- main

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '**/azpipe.csproj'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\'
    platform: '$(buildConfiguration)'
    configuration: '$(buildConfiguration)'

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

当我运行管道时,出现错误,这是日志

Publish:
  azpipe -> D:\a\1\s\obj\Debug\net5.0\PubTmp\Out\
_TransformWebConfig:
  No web.config found. Creating 'D:\a\1\s\obj\Debug\net5.0\PubTmp\Out\web.config'
_PrepareForMsDeployPublish:
  Creating directory "D:\a\1\a\ \p:platform=Release \p:configuration=Release \p:VisualStudioVersion=17.0 \p:_MSDeployUserAgent=VSTS_ac5aa204-3429-4edf-ae3d-777f0b31c141_build_9_0\".
##[warning]C:\Program Files\dotnet\sdk\6.0.202\Sdks\Microsoft.NET.Sdk.Publish\targets\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeployPackage.targets(156,5): Warning MSB3191: Unable to create directory "D:\a\1\a\ \p:platform=Release \p:configuration=Release \p:VisualStudioVersion=17.0 \p:_MSDeployUserAgent=VSTS_ac5aa204-3429-4edf-ae3d-777f0b31c141_build_9_0\". The given path's format is not supported.
C:\Program Files\dotnet\sdk\6.0.202\Sdks\Microsoft.NET.Sdk.Publish\targets\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeployPackage.targets(156,5): warning MSB3191: Unable to create directory "D:\a\1\a\ \p:platform=Release \p:configuration=Release \p:VisualStudioVersion=17.0 \p:_MSDeployUserAgent=VSTS_ac5aa204-3429-4edf-ae3d-777f0b31c141_build_9_0\". The given path's format is not supported. [D:\a\1\s\azpipe.csproj]
  The previous error was converted to a warning because the task was called with ContinueOnError=true.
  Build continuing because "ContinueOnError" on the task "MakeDir" is set to "true".

到目前为止,有很多这样的行。

我尝试了几种找到的解决方案,但无法使其工作。 有人可以帮助我吗?

谢谢!

最佳答案

根据警告消息“Warning MSB3191:无法创建目录”D:\a\1\a\\p:platform=Release\p:configuration=Release\p:VisualStudioVersion=17.0\p: _MSDeployUserAgent=VSTS_ac5aa204-3429-4edf-ae3d-777f0b31c141_build_9_0\"。不支持给定路径的格式。"

给定路径的格式似乎不正确。在您的 yaml 文件中,您指定了项目,但没有指定解决方案。

请指定解决方案而不是项目,引用以下格式:

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
    platform: '$(buildConfiguration)'
    configuration: '$(buildConfiguration)'

关于Azure构建管道不起作用: unable to create directory D:\a\1\a\,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72087219/

相关文章:

azure - 部署连续的Azure WebJob和WebApp会阻止App

Azure 角色失败通知

python - 无法在 azure 管道中发布代码覆盖率

azure-devops - Visual Studio Team Services 中的 xUnit Visual Studio 测试

azure-pipelines - 如何更改 Azure Devops YAML 管道的默认分支

c - 使用 REST 将批量事件发送到 Azure 事件中心

azure - 无法 RDP 到 CentOs 7 Azure VM

c# - 如何获取 Service Fabric 微服务的实例数?

azure - 如何在 Azure DevOps 管道上以编程方式下载日志?

protractor - 运行 Protractor 测试时更改VSTS代理 session 屏幕分辨率