I have set up a build in team city, with a NuGet package reference in the test project.
The folder structre I have used is
\
|- Project1
\- Project1.csproj
|- Project1.Test
\- Project1.Test.csproj
|- packages
\- lib
\- RhinoMocks
The Project1 project builds sucessfully, but the Test project fails on the ResolveAssemblyReferences step. The relative path seems to be incorrect.
[13:16:55]: [ResolveAssemblyReference] C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360, 9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Rhino.Mocks, Version=3.6.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
[13:16:55]: [ResolveAssemblyReference] For SearchPath "{HintPathFromItem}".
[13:16:55]: [ResolveAssemblyReference] Considered "..\packages\RhinoMocks.3.6\lib\Rhino.Mocks.dll", but it didn't exist.
TeamCity build config:
- MSBuild task
- Build file path: Project1.Test\Project.Test.csproj
- Working directory: %system.teamcity.build.checkoutDir%\Project1.Test
- VCS root points to the root of the folder structure above.
As far I can tell this may be a MSBuild issue, I get the same error when I run MSBuild at the command line in the checkout folder on the build agent.
More info: The hint path is being provided by the Nuget package configuration. Within Visual Studio the package reference works correctly. However, when running via MSBuild, it seems confused about its current directory. The ..\packages... path is actually the verbatim reference path from Nuget.