1
votes

I am using Azure Devops to deploy Angular 6 + asp.net application.

ng build --prod command perfectly deploying to destination folder which is in outputPath of angular.json

During release definition(CD), we need to clear all the files in the existing outputPath.

Because existing web deployment already having main.{oldhashvalue}.js.

if I am doing next release definition then it adds another main.{newhashvalue}.js to the same outputPath.

This creates the issue that the application still refers the old main.{oldhashvalue}.js.

So, how to clean old outputPath before the next deploy during release definition?

Here is the YAML format of release definition

steps:

  • task: AzureRmWebAppDeployment@3

    displayName: 'Deploy Azure App Service to Slot'

    inputs:

    azureSubscription: 'azureSubscription - Service Endpoint'

    WebAppName: firstwebappname

    DeployToSlotFlag: true

    ResourceGroupName: firstresourcegroupname

    SlotName: dev

    Package: '$(System.DefaultWorkingDirectory)***.zip'

    TakeAppOfflineFlag: true

    UseWebDeploy: true

    RenameFilesFlag: true

I already tried enabling "Remove additional files at destination" option but it clears the node_modules folder which is needed always. Don't wanted to install all the time.

enter image description here

1
Is there a Publish Using Web Deploy options above the Remove add'l files?Stinky Towel
Yes. it is checked.ggn979
My bad, that's showing in the yaml as well. What about a task to delete files in the outputpath before build?Stinky Towel
Build process cleans the previous outputPath. I verified the deployment zip file. This issue is happening during the release definition. Before it deploy, it has to clear the outputPath folder.ggn979
Can you add a delete files task to the Release pipeline then?Stinky Towel

1 Answers

0
votes

During build, direct your output to $(Build.ArtifactStagingDirectory). That folder is cleared out every time a build runs.