0
votes

I have a project that is built using teamcity. Inside teamcity the packages are downloaded using NuGet

On our local machines in VS everything works fine, but the Buildserver throws:

[13:30:31][ResolveAssemblyReference] Primary reference "System.Web.Http".

[13:30:31][ResolveAssemblyReference] C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1635, 5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Http". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

[13:30:31][ResolveAssemblyReference] For SearchPath "{HintPathFromItem}".

[13:30:31][ResolveAssemblyReference] Considered "..\packages\Microsoft.AspNet.WebApi.Core.5.0.0\lib\net45\System.Web.Http.dll", but it didn't exist.

IMHO it should be inside the WebApi.Core which is included inside the packages conf:

<?xml version="1.0" encoding="utf-8"?>

<packages>
  <package id="Autofac" version="3.2.0" targetFramework="net45" />
  <package id="Autofac.Mvc4" version="3.1.0" targetFramework="net45" />
  <package id="FluentValidation" version="5.0.0.1" targetFramework="net45" />
  <package id="libphonenumber-csharp" version="4.10.0.62" targetFramework="net45" />
  <package id="log4net" version="2.0.3" targetFramework="net451" />
  <package id="Microsoft.AspNet.WebApi" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.1.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.OData" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.Tracing" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.0.0" targetFramework="net45" />
  <package id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net45" />
  <package id="Microsoft.Data.OData" version="5.6.0" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="4.5.11" targetFramework="net451" />
  <package id="System.Spatial" version="5.6.0" targetFramework="net45" />
</packages>

There is already a NuGet-Step in TeamCity and it seems to work:

install] NuGet command: E:\buildAgent1\plugins\nuget-agent\bin\JetBrains.TeamCity.NuGetRunner.exe E:\buildAgent1\tools\NuGet.CommandLine.DEFAULT.nupkg\tools\NuGet.exe install E:\buildAgent1\work\78d708595d531418\Common\My.RestConnector\packages.config -OutputDirectory E:\buildAgent1\work\78d708595d531418\Common\packages

[13:30:15][install] Starting: E:\buildAgent1\temp\agentTmp\custom_script3183978839714032953.cmd

[13:30:15][install] in directory: E:\buildAgent1\work\78d708595d531418\Common\My.RestConnector

[13:30:15][install] JetBrains TeamCity NuGet Runner 8.0.27692.9

[13:30:15][install] Registered additional extensions from paths: E:\buildAgent1\plugins\nuget-agent\bin\plugins-2.5

[13:30:15][install] Starting NuGet.exe 2.8.50506.491 from 

    E:\buildAgent1\tools\NuGet.CommandLine.DEFAULT.nupkg\tools\NuGet.exe

    [13:30:16][install] Installing 'FluentValidation 5.0.0.1'.

    [13:30:16][install] Installing 'Autofac 3.2.0'.

    [13:30:16][install] Installing 'libphonenumber-csharp 4.10.0.62'.

    [13:30:16][install] Installing 'Autofac.Mvc4 3.1.0'.

    [13:30:16][install] Successfully installed 'Autofac.Mvc4 3.1.0'.

    [13:30:16][install] Installing 'Microsoft.AspNet.WebApi 5.0.0'.

    [13:30:16][install] Successfully installed 'Microsoft.AspNet.WebApi 5.0.0'.

    [13:30:16][install] Successfully installed 'FluentValidation 5.0.0.1'.

    [13:30:16][install] Successfully installed 'Autofac 3.2.0'.

    [13:30:16][install] Installing 'Microsoft.AspNet.WebApi.Tracing 5.0.0'.

    [13:30:16][install] Installing 'Microsoft.AspNet.WebApi.OData 5.0.0'.

    [13:30:16][install] Successfully installed 'Microsoft.AspNet.WebApi.Tracing 5.0.0'.

    [13:30:16][install] Installing 'Microsoft.AspNet.WebApi.Client 5.1.0'.

    [13:30:16][install] Successfully installed 'libphonenumber-csharp 4.10.0.62'.

    [13:30:16][install] Successfully installed 'Microsoft.AspNet.WebApi.OData 5.0.0'.

    [13:30:16][install] Installing 'Microsoft.AspNet.WebApi.WebHost 5.0.0'.

    [13:30:16][install] Successfully installed 'Microsoft.AspNet.WebApi.WebHost 5.0.0'.

    [13:30:16][install] Successfully installed 'Microsoft.AspNet.WebApi.Client 5.1.0'.

    [13:30:17][install] Installing 'Microsoft.Data.OData 5.6.0'.

    [13:30:17][install] Installing 'Newtonsoft.Json 4.5.11'.

    [13:30:17][install] Installing 'Microsoft.Data.Edm 5.6.0'.

    [13:30:17][install] Installing 'System.Spatial 5.6.0'.

    [13:30:17][install] Successfully installed 'Newtonsoft.Json 4.5.11'.

    [13:30:17][install] Successfully installed 'System.Spatial 5.6.0'.

    [13:30:17][install] Successfully installed 'Microsoft.Data.Edm 5.6.0'.

    [13:30:18][install] Successfully installed 'Microsoft.Data.OData 5.6.0'.

    [13:30:18][install] All packages listed in packages.config are already installed.
2

2 Answers

2
votes

You didn't download packages on your build server include:

nuget restore your.sln 

in your build script (if you're using build script) on your build server.

'restore solution mode' is only available in nuget 2.7

But in TeamCity you can select a 'NuGet Installer' step, that will do that for you. Here is an example of configured nuget installer step: http://img.hihi.si/Upload/1tFR.png

Be sure to reorder steps and use this step before build step.

EDIT 1: after you included build log from a build step, i've noticed there is no output for Installing Microsoft.AspNet.WebApi.Core. This could be a number of things, e.g. projects are not included in solution, packages.config are not included into source control...,something is messed up in the relation with solution/project/packages.config try adding a dummy package into that mvc project and check the output on your build server, if there's no trace of that package in build log the project is being skipped for some reason, if package is included in build log the problem is with that package. I'd also try reinstalling this package.

0
votes

Updating Microsoft.AspNet.WebApi to 5.2.2 solved the issue