Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build fails in teamcity for Nuget packages

I added to my solution via Nuget the Autoumapper and NUnit packages and they work great and the project compiles in my computer.

When i declared the build server to build this solution i got this messages:

[MSBuild] AutoMapper\AutoMapperSpike.csproj: Build default targets (1s)
[10:35:50][AutoMapper\AutoMapperSpike.csproj] ResolveAssemblyReferences
[10:35:50][ResolveAssemblyReferences] ResolveAssemblyReference
[10:35:50][ResolveAssemblyReference] Primary reference "AutoMapper".
[10:35:50][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 "AutoMapper". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
[10:35:50][ResolveAssemblyReference]         For SearchPath "{HintPathFromItem}".
[10:35:50][ResolveAssemblyReference]         Considered "..\packages\AutoMapper.2.2.1\lib\net40\AutoMapper.dll", but it didn't exist.

Does anyone know how to solve this problem?

Another thing i noticed is that it creates artificts in build server also with the packages folder. The only thing it can`t do is build the project in the build server.

like image 693
FelProNet Avatar asked Jul 11 '13 07:07

FelProNet


1 Answers

In a Visual Studio environment, there’s an option in the UI that sets a value on your user profile so you never have to remember it again. On a build server, though, there’s no such option. Instead, you have to set the environment variable “EnableNuGetPackageRestore” to “true” as part of your build.

I would recommend against trying to set the environment variable inside your build scripts or .csproj files. Here’s the blog article all about why it happened and what to set on your dev machine/build server.

like image 179
RinoTom Avatar answered Sep 28 '22 00:09

RinoTom