You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多
文档控制台
免费开始使用

Azure DevOps发布至Azure VM失败:IIS部署找不到指定包

Hey Krishna, let's work through fixing that "No package found with specified pattern" error you're hitting when deploying to your Azure VM's IIS. Since you're new to Azure DevOps, I'll walk you through the most common root causes and checks step by step:

1. Verify your build is actually generating a deployment package

First things first—if your build pipeline isn't outputting a deployable ZIP package, the deployment step will never find it.

  • Check your build YAML for tasks like VSBuild@1 (for ASP.NET Framework) or DotNetCoreCLI@2 (for ASP.NET Core). For example, an ASP.NET Core build needs the publish command to generate a package:
    - task: DotNetCoreCLI@2
      inputs:
        command: 'publish'
        publishWebProjects: true
        arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
        zipAfterPublish: true
    
  • Look at your build logs for lines confirming the package was created. You should see something like: Successfully created package 'D:\a\1\a\YourProject.zip'. If you don't see this, your build isn't configured to generate the package at all.
2. Make sure your deployment task is looking in the right path

The error almost always comes from a mismatch between where your build stores the package and where your deployment task is searching for it.

  • Check the package parameter in your IISWebAppDeploymentOnMachineGroup@0 task (or the IIS deploy task you're using). Common mistakes here:
    • If you're using a separate build and release pipeline: Your deployment should pull the package from the pipeline workspace, e.g., $(Pipeline.Workspace)/drop/**/*.zip (where drop is the name of your published artifact).
    • If it's a single build-deploy pipeline: Use $(Build.ArtifactStagingDirectory)/**/*.zip to reference the package directly from the build's output directory.
  • Cross-reference the path in your deployment task with the package path from your build logs. If they don't align, adjust the package value to match.
3. Confirm artifacts are being passed between stages

If you split your workflow into separate build and release stages:

  • Ensure your release pipeline is linked to the correct build artifact. Go to your release pipeline's Artifacts tab and verify you've added the build artifact from your project.
  • Check that your build pipeline includes a task to publish the artifact (like PublishBuildArtifacts@1 or PublishPipelineArtifact@1). For example:
    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ArtifactName: 'drop'
        publishLocation: 'Container'
    

This step makes the package available to subsequent deployment stages.

4. Debug with a directory listing task

If you're still stuck, add a quick command task right before your IIS deploy step to list all files in your workspace. This will show you exactly what's available to the deployment task:

- task: CmdLine@2
  inputs:
    script: 'dir $(Pipeline.Workspace) /s /b'

Run the pipeline again and check the logs for this task. If you don't see your ZIP package in the output, you'll know the issue is with how the package is being passed (or not passed) to the deployment stage.

Most of the time, this error boils down to a simple path mismatch or a missing step to publish the build artifact. Walk through these checks, and you should be able to get your deployment working.

内容的提问来源于stack exchange,提问作者Krishna Rpr

火山引擎 最新活动