7

Box was sitting on breakpoint last night when I went to bed. This morning there are service updates which shuts down VS. I reopen VS, do some work to prep for debug, then build. Build fails with: error MSB3231: Unable to remove directory "csx\Debug\". Access to the path 'Microsoft.WindowsAzure.Diagnostics.dll' is denied.

VS is running in Admin mode.

1
  • Can't answer yet so I'll post answer here for now: Rebooted box. Then opened in Admin mode again. Cleaned and rebuilt. That seemed to work. Probably an issue with leaving VS open during the updates.
    – DFBerry
    Jan 31, 2012 at 14:00

6 Answers 6

12

Sometimes Azure Emulator doesn't behave as it shoud and keeps running some processes. You can examine this with ProcessExplorer.

In such cases I re-srtart both emulator services, but in your case restart of the Compute emulator should be enough.

0
2

In Visual Studio 2013 I was able to fix this same error by unloading the Azure project and then reloading and building, this seemed lot easier than the answers already provided hence the reason I am answering an already answered question

0

The best solution I have seen to that is to create a “Post Build Event” to remove the read-only attribute:

attrib -R "$(TargetDir)*.*" /S

That should fix the problem

1
  • Did not work for this problem, but might still come in handy later. May 1, 2012 at 15:09
0

I have this problem constantly. The following has helped me to clear the issue up:

  1. Disable antiviruses
  2. Disable Windows Search
  3. Disable any file-scanning service
0

Clean the solution.It will resolve the problem.

1
  • This isn't going to solve the issue if the problem is some other open program holding onto those directories. Jun 9, 2014 at 17:10
0

The problem is usually that another program is holding onto those directories/files. Closing the offending program ought to free up access and let the Azure build tasks run again.

In my case just now, it was Windows Grep. Another possible culprit is IE (see: http://www.dotnetnoob.com/2013/09/the-unable-to-remove-directory.html).

If needed, you should be able to figure out which program it is by using Process Explorer from the Sysinternals suite, which can show you open file handles. From the Process Explorer menu bar, hit "Find" -> "Find Handle or DLL...", enter part of the path that the Azure build's complaining about, and check the resulting list of programs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.