【问题标题】:How to deploy code without zip file and inner folders azure devopsHow to deploy code without zip file and inner folders azure devops
【发布时间】:2022-12-01 13:22:16
【问题描述】:

I'm new to Azure DevOps and trying to configure CI/CD pipelines. Here are the steps that I followed.

  1. Created VM and setup IIS
  2. Created pipeline on Azure devops with Github source code. Here is yml file.

    azure-pipelines.yml

    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:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'
    
    - task: VSTest@2
      inputs:
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'
    
    - task: CopyFiles@2
      inputs:
        contents: 'build/**'
        targetFolder: '$(Build.ArtifactStagingDirectory)'
        cleanTargetFolder: true
    
    - task: PublishBuildArtifacts@1
      inputs:
        pathtoPublish: '$(Build.ArtifactStagingDirectory)'
        artifactName: 'drop'
    
    1. Created and configure Deployment groups, and setup agent with auth token

    Build and deployment works fine, but there are 2 problems

    1. Build generates artifacts with zip file.

      1. zip file has lot more inner folder where actual executable files are located.

【问题讨论】:

  • Actually build always produces zipped artifacts(It definitely decreases ADO storage problems) and you need to unzip these after downloading.
  • what does your release pipeline look like? there are usually some settings in the deploy step to whether to use a zip file or not.
  • @ScottMildenberger: Do you want to see something like this?
  • Look at the individual steps in the 'Deploy' stage and look at the step that is actually deploying the code to the server and then look at the settings in that step

标签: azure azure-devops azure-pipelines blazor-webassembly


【解决方案1】:

You could use IISWebAppDeploymentOnMachineGroup@0 - IIS web app deploy v0 task in your release pipeline.

Using predefined variable to locate the .zip

$(System.DefaultWorkingDirectory)***.zip

This task supports the .zip fileextract.

【讨论】:

    猜你喜欢
    • 2022-12-02
    • 2022-12-01
    • 2022-12-01
    • 1970-01-01
    • 2022-12-26
    • 2022-12-02
    • 2022-12-28
    • 2017-05-03
    • 2022-12-26
    相关资源
    最近更新 更多