56

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.

Joshcodes
  • 8,513
  • 5
  • 40
  • 47
  • I think you will need to include how you deployed. making sure the file is removed via git is different than TFS. – Dennis Burton Jul 04 '13 at 18:44
  • 1
    I agree with @DennisBurton, please tell us how you are deploying. Are you using Web Deploy? You could always FTP in the website and manually delete the file. – Fernando Correia Jul 05 '13 at 18:47
  • @FernandoCorreia would FTP work with git deployment? I was thinking you could not do both. – Dennis Burton Jul 05 '13 at 18:51
  • @DennisBurton, clarifying my answer, git deployment would be a recommended and automated way. I just wanted to point out that if he is doing Web Deploy he could try to fix it manually by deleting the DLL as an experiment. Joshcodes, please provide more details about how you are deploying. – Fernando Correia Jul 05 '13 at 19:10
  • This project is being deployed directly from Visual Studio with the publish menu item. – Joshcodes Jul 06 '13 at 22:45
  • This is a good reference to work with the files deployed to an Azure Web site: https://www.jamessturtevant.com/posts/How-to-add-edit-and-remove-files-in-your-azure-webapp-using-the-kudu-service-dashboard/ – Leniel Maccaferri Jul 04 '19 at 14:33

6 Answers6

122

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)

enter image description here

Also can be detailed here: MSDN

ElvisLives
  • 2,275
  • 2
  • 18
  • 24
  • 2
    Thankyou so much, I kept creating new websites on Azure and updating my DNS settings because I coudln't figure this out, no more! – JMK Mar 27 '14 at 22:13
  • Wow. 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. – Robert Noack Jan 20 '15 at 19:46
  • Where can this settings be found on using VS 2013? – Shimmy Weitzhandler Mar 18 '15 at 01:26
  • 1
    It'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! – ElvisLives Mar 18 '15 at 17:00
  • This should be set by default – rollsch Mar 27 '17 at 22:27
22

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.

MikeB
  • 413
  • 4
  • 8
4

You can also use console to delete any file. Kudu is a web tool that allow you to see inside of Azure web application.

enter image description here

Two ways to access Kudu

  1. go here: https://yoursite.scm.azurewebsites.net/DebugConsole/?shell=powershell (replace with your real website name)
  2. login to portal > app services > your site > Development tools > Advanced tools. enter image description here
Rm558
  • 4,621
  • 3
  • 38
  • 43
3

You can also delete files via Webmatrix (link in footer menu in Azure configuration portal)

Martenti
  • 141
  • 1
  • 3
  • I 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 Feb 22 '16 at 22:47
  • any idea where they put this webmatrix link since they updated the Azure dashboard to the windows tiles style UI? – Francisc0 May 09 '16 at 15:20
3
  1. Download the profile from Azure portal Download publish profile

  2. Import publish profile in VS enter image description here

  3. Stop the web app in Azure portal enter image description here 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 enter image description here

  1. Start the web app again after publish succeeds.
detale
  • 12,482
  • 4
  • 41
  • 42
0

for linux servers you dont get, CMD, then all you have to do its, Delete the deployment, then create deployment credentials for FTP and there you go with FTP client clean the wwwroot folder by your self.

emamones
  • 77
  • 7