Clean Windows Azure Website
Solution 1
When you right click and click Publish Web on the left hand side there should be a settings tab. Click this. Then expand the option under File Publish Options and check the Box for Remove addtional files at destination. (This will wipe out whats already there)
Also can be detailed here: MSDN
Solution 2
Another trick to delete an entire Azure website deployment which can be done entirely in the Azure portal is:
1) Create a new empty deployment slot under the Azure website. 2) Swap it with the parent Azure website.
That will give you an empty Azure website. If you want you can delete the deployment slot afterwards.
Solution 3
You can also use console to delete any file. Kudu is a web tool that allow you to see inside of Azure web application.
Two ways to access Kudu
- go here: https://yoursite.scm.azurewebsites.net/DebugConsole/?shell=powershell (replace with your real website name)
- login to portal > app services > your site > Development tools > Advanced tools.
Solution 4
- Download the profile from Azure portal
- Import publish profile in VS
- Stop the web app in Azure portal
Stopping the web app ensures existing files including dlls and other resources will be deleted after publish succeeds.
This step might not be necessary, however, the existing web app could have some dlls that cannot be removed during publish directly, returning error messages like:
Web deployment task failed. (Unable to perform the operation ("Delete File") for the specified directory ...
4. Publish with “Remove additional files at destination” checked
- Start the web app again after publish succeeds.
Solution 5
You can also delete files via Webmatrix (link in footer menu in Azure configuration portal)
Joshcodes
AS AN OCCUPATION: I provide custom software development and represent East Five's clients' interests in technology negation and direction. I also provide coaching for software teams. My areas of expertise are data science and cloud based systems. STREET CRED: Ph.D. University of Hawai'i | Overcoming the Difficulties Created by the Volatile Nature of Desktop Grids TLDR/MarketingSpeak: If "Data science" is used to schedule parallel tasks in an "unconventional cloud," applications run faster and cheaper. For extra credit (more chapters): my complicated formulas tell you how much faster and cheaper. FOR FUN: Anything on the water (waterskiing, sailing, surfing) or in the air (private pilot) All original source snippets I post on Stack Overflow are dedicated to the public domain. Do with them as you see fit.
Updated on March 15, 2020Comments
-
Joshcodes about 4 years
My ASP.NET MVC project pushed to a Azure website with an extra DLL which is invalid. This is keeping the project from running correctly. If a new website is created it works perfectly. Cleaning the project locally and redeploying does not fix the problem. Is there a way to perform a "remote clean?"
This project is being deployed directly from Visual Studio with the publish menu item.
-
JMK about 10 yearsThankyou so much, I kept creating new websites on Azure and updating my DNS settings because I coudln't figure this out, no more!
-
Robert Noack over 9 yearsWow. Thanks for this. Literally wasted about an hour because this setting is not the default... and there will likely never be a time I don't want this selected.
-
Shimmy Weitzhandler about 9 yearsWhere can this settings be found on using VS 2013?
-
ElvisLives about 9 yearsIt's not a setting in Visual Studio but for the project. So you will see that menu when you right click on a web project and hit Publish. Just follow the instructions above!
-
Jose A about 8 yearsI recommend this too over anything else. If you select "Remove additional files at destination" you can potentially erase important content. Because everything that is not in the Solution Explorer of Visual Studio will be wiped out. For example I had created articles through the MVC app and it uploaded some pictures under the content directory. Since these were not included in my local Solution Explorer of Visual Studio they were wiped out at upload, creating a very painful restoration procedure.
-
Jose A about 8 yearsI think you cannot do that if you are under Shared or lower.... Nice trick for Basic and up!
-
Francisc0 almost 8 yearsany idea where they put this webmatrix link since they updated the Azure dashboard to the windows tiles style UI?
-
Narottam Goyal almost 8 yearsdude you saved my hours of work, Thank you very much!
-
hultqvist almost 8 yearsCannot be done for Basic, Shared or Free, you need Standard or Premium to use it.
-
rollsch about 7 yearsThis should be set by default