Base solution for your next web application
Open Closed

avoid having to copy all files from Angular deploy dist folder #11081


User avatar
0
henryand created

we are running anz10 angular .net5 combined

i have been doing webdeploy from visual studio to Azure deployment slot, then moving all of the files from wwwroot/wwwroot/dist/ to wwwroot/wwwroot using filezilla after every deploy. this has been very time consuming. I have tried changing the angular.json outputPath to wwwroot, but that causes errors when trying to publish because several files are then missing. i can change it to any folder name below wwwroot, but not to the actual wwwroot that Azure expects to find the app.

Can the angular project be setup to run from inside the dist folder so that the files don't need to be moved up one folder?

thanks, Red Cedar


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @henryand

    Using a script like this https://github.com/aspnetzero/aspnet-zero-core/commit/4e0db028538ace3379bc3199f1aa88c14cdf50fd might help you about this.

  • User Avatar
    0
    henryand created

    that automates the process, but does not remove the time to copy all of the files. it seems the files can't be generated in the place where they are expected to be used (./wwwroot/) so i was asking if we could use them where they are generated (./wwwroot/dist/). it seems very odd to me that we publish both the api and the angular to the webserver at the same time but only the api will run after publish. the entire angular app needs to be moved twice - to the correct folder and to azure.

    is there a way to define the angular app's root folder as the dist folder?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @henryand

    Sorry, I got your question wrong. Leaving outputPath empty in angular.json might solve this problem for you.

    outputPath: "",

  • User Avatar
    0
    henryand created

    we found our solution. i'm posting it here for anyone that may read this thread.

    Since azure expects the angular app to be in WWWROOT instead of WWWROOT/DIST, we can build it in wwwroot/ but only if angular knows not to delete the existing contents.

            "outputPath": "wwwroot/",
            "deleteOutputPath": false,