Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Validation' does not exist in the namespace 'System.Data.Entity' when building on Team City

I have a project that is working perfectly on my computer, but when trying to build it on Team City i get the following build error for source files where i have

using System.Data.Entity;    
using System.Data.Entity.Validation;


CS0234: The type or namespace name 'Validation' does not exist in the namespace 'System.Data.Entity' (are you missing an assembly reference?)

Do I need to install Entity Framework manually on the server running Team City for this to work?

Update after activating Nuget Restore:

This must be some kind of configuration issue.

I can see in the build log that the build process is copying the .dll:

[Copy] Copying file from "D:\TeamCity\agent1\work\541c9f462afc285d\packages\EntityFramework.5.0.0\lib\net45\EntityFr    amework.dll" to "bin\Release\EntityFramework.dll".
[16:51:55][Copy] Copying file from "D:\TeamCity\agent1\work\541c9f462afc285d\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.xml" to "bin\Release\EntityFramework.xml".

But shortly after, it is considering a bunch of different locations, but not including the bin\Release\EntityFramework.dll" folder.

Update 2:

Manually copying the .dll to the bin/release folder of my class library helped the build to pass, but obviously this is no viable solution, so will need to keep on finding out how to configure this correctly.

Update 3:

Never did find a satisfying solution for this I am sad to say, so any genius that can solve this are very welcome. :)

like image 970
Bjørn Otto Vasbotten Avatar asked Nov 10 '22 05:11

Bjørn Otto Vasbotten


1 Answers

As an error suggested you are missing assembly. And as @Shriroop suggested this is in EF packge.

Before your compile step, add Nuget Installer step. There are few options you should set, Path to solution name and I suggest you use nuget 2.7+ and Restore mode: Restore.

To install latest nuget version in teamcity go to Administration > Nuget Settings > NuGet.exe and fetch latest version.

Here is a sample of NuGet Installer step: http://img.hihi.si/Upload/5PUm.png

like image 134
Dejan Dakić Avatar answered Nov 14 '22 22:11

Dejan Dakić