Visual Studio Publish Failed: "Unable to delete file ... Access to the path ... is denied."

Viewed 38300

I've recently switched from a Windows XP machine to Windows 7. I use Subversion and TortoiseSVN.

I cannot publish my .NET application in Visual Studio. I get over a thousand errors like this:

Unable to delete file "obj\Debug\Package\PackageTmp\Views\ViewName.svn\text-base\ActionName.aspx.svn-base". Access to the path 'C:\Code\SolutionName\ProjectName\obj\Debug\Package\PackageTmp\Views\ViewName.svn\text-base\ActionName.aspx.svn-base' is denied.

Visual Studio: "Publish failed"

Why is Subversion giving me trouble? How do I fix it?


I disabled the file indexing of my bin and obj folders. But, that didn't work.

Allow files in this folder to have contents indexed in addition to file properties

11 Answers

What actually works is the solution that Zack Peterson gave? Thanks Zack!

I am writing an application that will automatically remove all of the .SVN folders and files during deployment. While doing so, I was getting the same error as described above.

  • Once I changed the folder to NOT be Read Only, I was able to delete files and folders programmatically.
  • My next step is to set the attribute programmatically on NOT Read Only so that I can accomplish the entire installation with the click of a button.

For me, the windows service was running in the background. closing the service from the task manager and then rebuilding the project did the job for me.

My problem resolved after doing:

  1. Close VS and Restart your machine.
  2. Update all your softwares to latest stable versions at Manage Nuget package for solution
  3. Run your test now.

Hope this helps.

Right click on the shortcut you start the IDE from and select properties. Click advanced and click'Run as Administrator'. Worked as charm for me.

Related