gpt4 book ai didi

azure - 如何从 Azure DevOps 中的文件夹(不是 zip)部署 WebApp

转载 作者:行者123 更新时间:2023-12-04 09:56:28 24 4
gpt4 key购买 nike

我无法使用文件夹来部署 DevOps,它给了我这个错误:

[error]Error: No package found with specified pattern: d:\a\1\a*.deploy.cmd
Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.

Azure 应用服务部署任务文档对 Package 参数进行了如下说明:

File path to the package, or to a folder containing App Service contents generated by MSBuild, or to a compressed zip or war file.

这是我的发布任务:

  - task: DotNetCoreCLI@2
inputs:
command: publish
publishWebProjects: false
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: false
modifyOutputPath: true
projects: |
src/Company/Project.csproj

和我的部署任务:

  - task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'PublishProfile'
PublishProfilePath: '$(System.DefaultWorkingDirectory)/src/Company/Properties/PublishProfiles/WebDeploy.pubxml'
PublishProfilePassword: '$(password)'
Package: '$(Build.ArtifactStagingDirectory)/Company'

为什么要寻找deploy.cmd?我做错了什么?

最佳答案

Error: No package found with specified pattern: d:\a\1\a*.deploy.cmd

从错误信息来看,这个问题的根本原因可能是你的路径中没有这个文件(xxx.deploy.cmd)。

“Dotnet Publish”任务不会生成此文件。

要解决此问题,您需要添加“Dotnet build”任务。此任务将生成必要的文件(例如deploy.cmd):

同时,您还需要在arguments字段中添加配置参数。

/p:DeployOnBuild=true /p:WebPublishMethod=package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)

这是一个例子:

- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: '**/*.csproj'
arguments: '/p:DeployOnBuild=true /p:WebPublishMethod=package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)'

- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: publish
....

然后将添加xxx.deploy.cmd。

enter image description here

希望这有帮助。

关于azure - 如何从 Azure DevOps 中的文件夹(不是 zip)部署 WebApp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61910176/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com