简体   繁体   中英

Unable to Publish the project from Azure DEVOPS

I am new for azure devops and learning purpose create new basic account from azure. I created new projects and did require changes. This project publishing the code into azure VM and it's giving error in final step.

Step: IIS Web App Deploy

Error: No package found with specified pattern.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.

YAML for Release:

steps:
- task: IISWebAppManagementOnMachineGroup@0
  displayName: 'IIS Web App Manage'
  inputs:
    IISDeploymentType: '$(Parameters.IISDeploymentType)'
    ActionIISWebsite: '$(Parameters.ActionIISWebsite)'
    WebsiteName: '$(Parameters.WebsiteName)'
    WebsitePhysicalPath: '%SystemDrive%\inetpub\wwwroot\DD'
    AddBinding: '$(Parameters.AddBinding)'
    Bindings: '$(Parameters.Bindings)'
    CreateOrUpdateAppPoolForWebsite: true
    AppPoolNameForWebsite: DD
    ParentWebsiteNameForVD: '$(Parameters.WebsiteName)'
    VirtualPathForVD: '$(Parameters.VirtualPathForApplication)'
    ParentWebsiteNameForApplication: '$(Parameters.WebsiteName)'
    VirtualPathForApplication: '$(Parameters.VirtualPathForApplication)'
    AppPoolName: '$(Parameters.AppPoolName)
    steps:
- task: IISWebAppDeploymentOnMachineGroup@0
  displayName: 'IIS Web App Deploy'
  inputs:
    WebSiteName: '$(Parameters.WebsiteName)'
    Package: '$(System.DefaultWorkingDirectory)/_ABC.API/drop/*.zip'
    RemoveAdditionalFilesFlag: true
    TakeAppOfflineFlag: true
    XmlVariableSubstitution: True

Build YAML:

trigger:
- master

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: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: CopyFiles@2
  inputs:
    SourceFolder: '$(agent.builddirectory)'
    Contents: |
      |
           **\*.runsettings
           **\*FunctionalTest*\**\bin\$(BuildConfiguration)\**
    TargetFolder: '''$(build.artifactstagingdirectory)\FunctionalTests'''


- task: PublishBuildArtifacts@1
  inputs:
    artifactName: 'drop'
    pathToPublish: '$(build.artifactStagingDirectory)'

Error Logs:

2020-04-19T10:02:47.0130907Z ##[section]Starting: IIS Web App Deploy
2020-04-19T10:02:47.0236460Z ==============================================================================
2020-04-19T10:02:47.0236816Z Task         : IIS web app deploy
2020-04-19T10:02:47.0237124Z Description  : Deploy a website or web application using Web Deploy
2020-04-19T10:02:47.0237414Z Version      : 0.156.9
2020-04-19T10:02:47.0237649Z Author       : Microsoft Corporation
2020-04-19T10:02:47.0238051Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/iis-web-app-deployment-on-machine-group
2020-04-19T10:02:47.0238500Z ==============================================================================
2020-04-19T10:02:47.8446908Z ##[error]Error: No package found with specified pattern.<br/>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.
2020-04-19T10:02:47.8471615Z ##[section]Finishing: IIS Web App Deploy

Please help to find the issue

Trying to change the section Package to use the path from pathToPublish by default it was System.DefaultWorkingDirectory .

- task: PublishBuildArtifacts@1
  inputs:
    artifactName: 'drop'
    pathToPublish: '$(build.artifactStagingDirectory)'

Change in IISWebAppDeploymentOnMachineGroup task:

- task: IISWebAppDeploymentOnMachineGroup@0
  displayName: 'IIS Web App Deploy'
  inputs:
    WebSiteName: '$(Parameters.WebsiteName)'
    Package: '$(build.artifactStagingDirectory)/*.zip'
    RemoveAdditionalFilesFlag: true
    TakeAppOfflineFlag: true
    XmlVariableSubstitution: True

Build.ArtifactStagingDirectory :

The local path on the agent where any artifacts are copied to before being pushed to their destination. For example: c:\agent_work\1\a

System.DefaultWorkingDirectory:

The local path on the agent where your source code files are downloaded. For example: c:\agent_work\1\s

For this,please refer to predefined variables .

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