Any opinions expressed here are my own and not necessarily those of my employer (I'm self-employed).

Sep 14, 2013

The "Unable to remove directory "bin\Release\app.publish\" Azure packaging error

Just a quick note on an error I often run into when I'm working on my Azure applications. I usually create Azure packages and upload them by hand through the Azure management portal. Ever so often I get the following error when I create the package in Visual Studio (2012).
Unable to remove directory "bin\Release\app.publish\". Access to the path 'AzureStartupTest.Azure.cspkg' is denied.
 Turns out someone is holding on to that file!!

When you create an Azure package, VS opens a file explorer window showing you the published files. You should close this explorer window before you run the package command again. It also turns out that Internet Explorer holds on to the file if you've uploaded it through the Azure management portal. If you refresh (F5) the management portal, IE lets go of the file and you can run the package command again without problems.

It seems I'm not the only one on the Internet running into this problem. I found some shady advice out there, such as rebooting your computer or disabling the antivirus to make the problem go away. I would recommend neither. With the aforementioned trick you can safely re-enable your antivirus and get back to work.


  1. Refreshing the IE page i had opened did the trick for me, thank you for the tip!.....It's always wise to start with the simple solutions, no matter the level of the issue.

  2. I simply deleted the bin\debug\app.publish folder and initiated a Rebuild and VS recreated the folder and all was fine

  3. Excellent solutions. Since I do not like the bypass option when turned off anti-virus.
    Richard Brown online data room


Copyright notice

© André N. Klingsheim and www.dotnetnoob.com, 2009-2015. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to André N. Klingsheim and www.dotnetnoob.com with appropriate and specific direction to the original content.

Read other popular posts