NuGet.exe pack gives access to the path is denied

前端 未结 9 1293
生来不讨喜
生来不讨喜 2021-01-07 15:56

When I try to pack my MVC project (NuGet.exe pack) I get:

NuGet.exe : Access to the path \'...\' is denied.

This happens to be

相关标签:
9条回答
  • 2021-01-07 16:37

    Apparently, you need to set ReadOnly=false for the files it accesses

    0 讨论(0)
  • 2021-01-07 16:37

    I ran into this with nuget restore after doing a git clean -fd with VisualStudio open: the packages/ directory was marked for deletion, and while several files were deleted, the packages/ folder itself was not as VisualStudio had the .nupkg files open.

    Once I closed VisualStudio and re-ran git clean, it removed the packages/ directory and then nuget was able to restore everthing correctly.

    0 讨论(0)
  • 2021-01-07 16:42

    My collegue just got this error, during all "worked on my machine". After some research I found out that the *.nuspec file for some reason wasn't added to the version control.

    0 讨论(0)
  • 2021-01-07 16:44

    Try running it as administrator.

    0 讨论(0)
  • 2021-01-07 16:56

    I was running into a similar problem. I attempted to restart Visual Studio, Run as Administrator (Which I always do), Set the folder attributes to ensure the 'Read-Only' flag was off. Regardless, whatever I did, I still encountered the error "access to the path is denied" when updating my Nu-Get packages.

    I was able to fix the issue by updating packages one-by-one. Choosing instead to go through each dependency and updating it. Once the dependency was updated I would choose another, sometimes the same error resulted in which case I would choose another until all my packages were successfully updated.

    It appears in my case the Nu-Get packages had to be updated in a particular order.

    Hope this helps someone out there

    0 讨论(0)
  • 2021-01-07 16:56

    I had this problem and it turned out windows had an update waiting for the next restart. Cleared with no problem after restarting and waiting for the update.

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