Bamboo cloud - MsBuild error MSB3075 when restoring nuget packages
Asked by Roberto Rodes:

Hello,

I just started the trial of Bamboo Cloud and I am experiencing a problem when trying to run a plan. This plan currently just clones a Github private repository and right after that it executes an MsBuild task of a Visual Studio 2013 solution with nuget package restore enabled.

Nonetheless when running this plan it fails. Having a look at the msbuild log it seems to be due to a nuget failure with multiple messages like the following ("Access is denied"):

*"C:\\build\\PRUEB-T3-JOB1\\source\\.nuget\\NuGet.exe" install "C:\\build\\PRUEB-T3-JOB1\\source\\Deebbler.Identity.AccountManagement.Application\\packages.config" -source "" -NonInteractive -RequireConsent -solutionDir "C:\\build\\PRUEB-T3-JOB1\\source\\ "*

*C:\\build\\PRUEB-T3-JOB1\\source\\.nuget\\NuGet.targets(100,9): error : Access is denied. \[C:\\build\\PRUEB-T3-JOB1\\source\\Deebbler.Identity.AccountManagement.Application\\Deebbler.Identity.AccountManagement.Application.csproj\]*

*C:\\build\\PRUEB-T3-JOB1\\source\\.nuget\\NuGet.targets(100,9): error MSB3075: The command ""C:\\build\\PRUEB-T3-JOB1\\source\\.nuget\\NuGet.exe" install "C:\\build\\PRUEB-T3-JOB1\\source\\Deebbler.Identity.AccountManagement.Application\\packages.config" -source "" -NonInteractive -RequireConsent -solutionDir "C:\\build\\PRUEB-T3-JOB1\\source\\ "" exited with code 5. Please verify that you have sufficient rights to run this command. \[C:\\build\\PRUEB-T3-JOB1\\source\\Deebbler.Identity.AccountManagement.Application\\Deebbler.Identity.AccountManagement.Application.csproj\]*

After a quite a long search on the web and multiple manual tests, I guess this has something to do with file permissions established by the Amazon EC2 Agent when cloning those files from the Github repository but however I've not been able to find a solution to this problem.

Any idea in this respect would be really appreciated. Thanks a lot in advance.


Answers:
author: Roberto Rodes
body: Still nothing. I just managed to make it work by using the workaround I previously talked about in my previous comment.At that moment I was just testing the product during the trial period since I was considering other alternatives as well. Finally we went for Go Continuous Delivery Server, which by the way is an on-premise open source solution (self-hosted by ourselves) but give us all the flexibility and control we needed.


author: Richard Stinear
body: Did you get this going on the Windows stock image Roberto? I'm following the same approach with the default Windows image but it's failing as the Bamboo service account doesn't have execute privileges on any downloaded source in the build directory (including the .nuget/nuget.exe file we have in source control).


author: Roberto Rodes
body: Still nothing to accomplish this with msbuild although I've managed to find a tricky solution by using a powershell script and the nuget.exe command line tool.This powershell script takes responsibility for nuget package restore (instead of leaving this task on msbuild) by calling the nuget.exe command line tool (I have downloaded and versioned this tool together with the script on the project repository).Right after that, the same script calls msbuild to build the project, once every nuget package is ready and it works fine.Hope this helps although I'd still like to know why this doesn't work directly through msbuild.


author: Mark Snelling
body: I'm also having this problem. Did you manage to solve it? I'm using a Windows Server 2012 R2 build agent with Visual Studio 2013 Community Edition installed. It's using Cygwin Git.


Tags: cloud