I finally caved and installed VS2015 on my build server to avoid the pains of installing the necessary components individually, but now I'm presented with a new error when building.
Running MSBuild on my solution yields the following error:
"C:\Users\Bamboo\bamboo-home\xml-data\build-dir\IMP-COOK-JOB1\Imp.Cook.Api\Imp.Cook.Api.sln" (default target) (1) ->
"C:\Users\Bamboo\bamboo-home\xml-data\build-dir\IMP-COOK-JOB1\Imp.Cook.Api\Imp.Cook.Api\Imp.Cook.Api.csproj" (default target) (2) ->
"C:\Users\Bamboo\bamboo-home\xml-data\build-dir\IMP-COOK-JOB1\Imp.Cook.Api\Imp.Cook.Models\Imp.Cook.Models.csproj" (default target) (3) ->
(ResolveNuGetPackageAssets target) ->
C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(89,5):
error : The package Microsoft.CSharp with version 4.0.0 could not be found in
C:\Users\Bamboo\.nuget\packages.
Run a NuGet package restore to download the package.
Now, I can manually create a .nuget folder in the Bamboo users dir, and that helps (it still fails on the next package Microsoft.NETCore.Portable.Compatibility
).
But what piece of the puzzle am I missing here? I run nuget restore
before running msbuild, and it gets the packages I use directly in my project.
Imp.Cook.Models
is a portable class library targeting Windows 10 Universal apps and .NET 4.6.
The build server is running Windows Server 2012.
I had more or less the same issue as you so I can share my insights in how I got it to work. First off we have Bamboo running as a service (4 agents). It is important to note that the services needs to logon as a user and not the system account to be able to restore the packages (I do not yet know why). Given that you have a user map indicated as the source for the packages I'll assume that part is ok.
Next up you need to have a properly configured nuget.config file that you will use together with NuGet.exe. Mine looks like this.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>
<activePackageSource>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</activePackageSource>
</configuration>
Then you need to run the restore command using NuGet.exe (I suggest you get the latest Commandline version from NuGet
I use the following command in a Bamboo step to restore the packages:
NuGet.exe restore "Path_To_Solution" -ConfigFile "path_To_ConfigFile" -NoCache
After that you should see the packages being downloaded to the C:\Users\Bamboo\.nuget\packages folder. When you try to build the solution in the next step using MsBuild it should work.