问题
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.

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.

回答1:
I noticed that my folders were read-only. I changed that.
It worked! Publish succeeded.

回答2:
I believe your issue is related to the default permissions assigned the to C: drive in windows 7 (and Vista).
- Open explorer and find the c:\code folder
- Right click on the c:\code folder and select properties
- select the security tab
- select the user ID "Users"
- In the permissions box, tick the "modify" allow box
- Select OK, OK until permision dialog boxes close
That should resolve the permission issue
回答3:
I had this same problem, and none of the previous solutions worked. What worked for me was to take the bin and obj folders out of repository. After doing that, I was able to publish.
回答4:
The most likely cause is a permissions issue. The path in question may have been created while you were running with elevated permissions and hence requires admin permissions to delete. Try running Visual Studio as an admin and see if the problem goes away.
If so then the best solution is to do the following
- Save the changes to that directory (check in if necessary)
- Delete the repository
- Re-check out the repository and ensure you are not running as an admin when doing so
回答5:
I just deleted the existing folders at the publish destination which then allowed publishing to work. Un-setting read-only didn't seem to work. (Not sure why this started occurring).
回答6:
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.
回答7:
Oddly enough, I tried building an old project with Visual Studio 2010. It gave me the error that it failed due to my access being denied. I tried to remove the read-only off the directory and had no luck.
Although, when I opened it in Visual Studio 2015, it gave me the error that my certificate was expired.
Upon creating a new certificate and rebuilding - everything was fine.
回答8:
If you are being denied access to any specific folder, then it is being used by some other application.Check if any other application is using that path to reference that folder of any file in that folder. In my case , my application was reference a file inside the bin folder. So every time i publish and delete the old one. error will be thrown that bin folder can not be deleted. access denied. i went in my application. checked in the refrenced path of each dll, removed the ones which referenced the publish path and BOOM Issue solved.
回答9:
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.
回答10:
My problem resolved after doing:
- Close VS and Restart your machine.
- Update all your softwares to latest stable versions at Manage Nuget package for solution
- Run your test now.
Hope this helps.
来源:https://stackoverflow.com/questions/3628348/visual-studio-publish-failed-unable-to-delete-file-access-to-the-path