Visual Studio Publish Failed: “Unable to delete file … Access to the path … is denied.”

前端 未结 11 1241
生来不讨喜
生来不讨喜 2021-02-12 13:43

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 tho

相关标签:
11条回答
  • 2021-02-12 14:03

    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.
    0 讨论(0)
  • 2021-02-12 14:04

    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.

    0 讨论(0)
  • 2021-02-12 14:08

    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.

    0 讨论(0)
  • 2021-02-12 14:12

    I believe your issue is related to the default permissions assigned the to C: drive in windows 7 (and Vista).

    1. Open explorer and find the c:\code folder
    2. Right click on the c:\code folder and select properties
    3. select the security tab
    4. select the user ID "Users"
    5. In the permissions box, tick the "modify" allow box
    6. Select OK, OK until permision dialog boxes close

    That should resolve the permission issue

    0 讨论(0)
  • 2021-02-12 14:13

    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.

    0 讨论(0)
  • 2021-02-12 14:16

    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.

    0 讨论(0)
提交回复
热议问题