TFS 2012 Build “Access to Path Denied”

后端 未结 15 1883
星月不相逢
星月不相逢 2020-12-04 12:42

I’m using TFS 2012 Build and running into an error

Access to the path is denied

The solution being built contains about 15 proje

相关标签:
15条回答
  • 2020-12-04 13:31

    I was having this problem and chose to ignore it because I didn't want to sacrifice build performance for the sake of getting rid of some benign error messages by NuGet. However, I seem to have stumbled across a solution while trying to solve another problem, and I think it is related. I think the order of fetching of NuGet packages is related to the build order of projects in the solution. So if this has somehow become disjointed, then NuGet may be the first casualty before you run into build errors where you start getting "Metadata file 'XXX.dll' could not be found" errors which annoyingly require you to build again until the build succeeds (as described here).

    So, I believe the solution is to follow the steps described in the accepted answer to the aforementioned question. Or, follow the more comprehensive steps in one of the alternative answers. In other words, disable building of all projects, restart VS, then re-enable building of all projects. This will (normally) resolve build order. And that should hopefully resolve the NuGet issue. Please let me know if this fixes it for anyone.

    0 讨论(0)
  • 2020-12-04 13:36

    as a lot of people have already stated before, this happens when building projects in parallel. Project A and B both referencing 3rd Party Library C (Copy Local) will cause this when they are build at the same Time - side by side.

    The real problem is, that TFS Build 2012 and below are configured that when building a solution, the whole output of the solution is copied to a single folder. Thats where the pains of parallel builds are having their origins.

    Since TFS 2013 you can easily solve this by setting the "Output location" in the build definition to "PerProject". This forces the build services to behave like a local msbuild run where the setings regarding the output locations are read from the corresponding project files. So the output is written to the bin folders under each project.

    For TFS 2012 and below this article (+linked articles) will help you getting the same result as with TFS 2013:

    http://blog.stangroome.com/2012/05/10/override-the-tfs-team-build-outdir-property-net-4-5/

    0 讨论(0)
  • 2020-12-04 13:39

    I resolved a very similar issue by closing all open instances of Visual Studio, re-opening the solution and building it again.

    0 讨论(0)
  • 2020-12-04 13:40

    It looks like there are two projects copying the same file. Depending on the timing, they sometimes happen at the same time, resulting in the failure. You have to trace the node id back to find the source project. See http://blogs.msdn.com/b/buckh/archive/2012/01/21/a-tool-to-find-duplicate-copies-in-a-build.aspx for more details and code that may track it down for you.

    0 讨论(0)
  • 2020-12-04 13:45

    This can also happen if you have a build agent's folder open.

    0 讨论(0)
  • 2020-12-04 13:45

    One possible cause is if you have the bin or obj folders for class libraries checked-in into TFS. Deleting the bin or obj folders of the projects from TFS will resolve this issue if that is the case.

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