简体   繁体   中英

How to deploy a WebApp from a folder (not a zip) in Azure DevOps

I cannot get DevOps to deploy using a folder, it is giving me this error:

[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 App Service Deploy Task documentation says this about the Package argument:

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

this is my publish task:

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

and my deploy task:

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

Why is it looking for a deploy.cmd? What am I doing wrong?

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

From the error message, the root cause of this issue could be that there is no such file(xxx.deploy.cmd) in your path.

The "Dotnet Publish" task will not produce this file.

To solve this issue, you need to add a "Dotnet build" task . This task will generate the necessary files (eg deploy.cmd):

At the same time, you also need to add configuration parameters in the arguments field.

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

Here is an example:

- 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
....

Then the xxx.deploy.cmd will be added.

在此处输入图像描述

Hope this helps.

Please try

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

The difference is in Package input.

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