Search code examples
azurevisual-studiopublish

Visual Studio and Azure: publication profile only uploads new files, doesn't overwrite previous


I'm publishing my project with a Publication Profile downloaded from azure (this was already configured by a previous developer).

The problem is, when publishing, only new files are uploaded, but modified files are not overwritten.

I checked option "Remove additional files at destination" and modified files did disappear, and weren't re-uploaded, so now I have errors.

Searching through publishing options I don't find other options to force this overwritting.

Any ideas?


Solution

  • I checked option "Remove additional files at destination" and modified files did disappear, and weren't re-uploaded, so now I have errors.

    The option Remove additional files at destination will allow to publish only the newly created files in the Application (which are not in the publish Profile).

    Even though you have made changes in the already existing files, as the file already exists in the deployed publish folder. The modified file gets ignored/deleted.

    Check the below Workaround.

    Initially I have deployed a sample WebApp using Import Profile (downloaded Publish Profile from Azure App Service).

    Initial Output:

    enter image description here

    Now, I have made few changes in the existing Privacy.cshtml file and also created a new Sample.cshtml file.

    • As you have mentioned checked the Remove additional files at destination and re-published the App.

    enter image description here

    • I have tried with both the options (by checking and unchecking Remove additional files at destination).

    • You can see that the WebApp is updated with the newly created Sample.cshtml file and the changes in the existing `Primary Page.

    enter image description here

    • Tried with both .cshtml and js files.

    enter image description here

    source code is in GIT repository.

    As your Source is already in Git Repo, update the Git Repository with the newly modified/created code files, Push the changes to Git Hub and deploy the App using GitHub from Deployment Center.

    enter image description here

    If you still face issues in publishing the Application, suggest you to publish the App using the New Profile => Azure => Azure App Service. enter image description here

    Select the same App Service from which you have downloaded the Publish Profile. enter image description here