Build error in TF build definition

0 votes

I have written a project using entity framework which is building and working fine locally. But if I try and run automated build using VSTS I get an error when I run the build definition. I think it's happening because of entity framework reference but I'm not sure of the root cause. Here's the error reference:

2016-12-08T07:42:52.1197143Z ##[error]MyMovieDatabase\Movies.Repository\MovieContext.cs(4,19): Error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
2016-12-08T07:42:52.1197143Z MovieContext.cs(4,19): error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) [C:\a\1\s\MyMovieDatabase\Movies.Repository\Movies.Repository.csproj]
2016-12-08T07:42:52.1197143Z ##[error]MyMovieDatabase\Movies.Repository\MovieContext.cs(5,19): Error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
2016-12-08T07:42:52.1197143Z MovieContext.cs(5,19): error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) [C:\a\1\s\MyMovieDatabase\Movies.Repository\Movies.Repository.csproj]
2016-12-08T07:42:52.1197143Z ##[error]MyMovieDatabase\Movies.Repository\MovieContext.cs(7,29): Error CS0246: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)
2016-12-08T07:42:52.1197143Z MovieContext.cs(7,29): error CS0246: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?) [C:\a\1\s\MyMovieDatabase\Movies.Repository\Movies.Repository.csproj]
2016-12-08T07:42:52.1197143Z ##[error]MyMovieDatabase\Movies.Repository\MovieContext.cs(17,33): Error CS0246: The type or namespace name 'CreateDatabaseIfNotExists' could not be found (are you missing a using directive or an assembly reference?)
2016-12-08T07:42:52.1197143Z MovieContext.cs(17,33): error CS0246: The type or namespace name 'CreateDatabaseIfNotExists' could not be found (are you missing a using directive or an assembly reference?) [C:\a\1\s\MyMovieDatabase\Movies.Repository\Movies.Repository.csproj]
2016-12-08T07:42:52.1197143Z ##[error]MyMovieDatabase\Movies.Repository\MovieContext.cs(40,35): Error CS0246: The type or namespace name 'DbConfiguration' could not be found (are you missing a using directive or an assembly reference?)
2016-12-08T07:42:52.1197143Z MovieContext.cs(40,35): error CS0246: The type or namespace name 'DbConfiguration' could not be found (are you missing a using directive or an assembly reference?) [C:\a\1\s\MyMovieDatabase\Movies.Repository\Movies.Repository.csproj]
2016-12-08T07:42:52.1197143Z ##[error]MyMovieDatabase\Movies.Repository\MovieRepository.cs(3,19): Error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
2016-12-08T07:42:52.1197143Z MovieRepository.cs(3,19): error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) [C:\a\1\s\MyMovieDatabase\Movies.Repository\Movies.Repository.csproj]
2016-12-08T07:42:52.1197143Z ##[error]MyMovieDatabase\Movies.Repository\MovieContext.cs(14,12): Error CS0246: The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?)

//Here's the Movies.Repository.csproj which refer the entity framework dlls:

` <ItemGroup> <Reference Include="EntityFramework"> <HintPath>..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.dll</HintPath> </Reference> <Reference Include="EntityFramework.SqlServer"> <HintPath>..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.SqlServer.dll</HintPath> </Reference>`
Aug 3, 2018 in DevOps Tools by ffdfd
• 5,550 points

edited Aug 3, 2018 by ffdfd 2,470 views

1 answer to this question.

0 votes

I think the problem is in your reference i.e. .csproject which is using local reference(from you packages directory in hard disk). This will not work if you deploy it on a server. Change it to your nigetpackages path. Also change the hint path for all the references in the format given below.

$(NugetPackagesPath)\EntityFramework.6.1.1\lib\net45\Entity‌​Framework.dll

To get the NugetPackgesPath:

<PropertyGroup>
    <!-- EnlistmentRoot is the base directory where all of the module root directories reside. --> 
    <EnlistmentRoot>$(MSBuildThisFileDirectory)</EnlistmentRoot>
    <EnlistmentRoot Condition="'$(EnlistmentRoot)' != ''">$([System.IO.Path]::GetFullPath('$(EnlistmentRoot)'))</EnlistmentRoot>
    <EnlistmentRoot Condition="'$(EnlistmentRoot)' != '' and !HasTrailingSlash('$(EnlistmentRoot)')">$(EnlistmentRoot)\</EnlistmentRoot>
</PropertyGroup>
<PropertyGroup>
    <!-- NuGetPackagesPath is the base directory for all nuget packages. --> 
    <NuGetPackagesPath>$(EnlistmentRoot)Ref\Packages</NuGetPackagesPath>
    <NuGetPackagesPath Condition="'$(NuGetPackagesPath)' != ''">$([System.IO.Path]::GetFullPath('$(NuGetPackagesPath)'))</NuGetPackagesPath>
    <NuGetPackagesPath Condition="'$(NuGetPackagesPath)' != '' and !HasTrailingSlash('$(NuGetPackagesPath)')">$(NuGetPackagesPath)\</NuGetPackagesPath>
</PropertyGroup>
answered Aug 3, 2018 by ajs3033
• 7,300 points

Related Questions In DevOps Tools

0 votes
2 answers
0 votes
1 answer

how to fix the build with maven in bluemix

As per Bluemix Status Page today DevOps Delivery Pipeline ...READ MORE

answered Jul 6, 2018 in DevOps Tools by Kalgi
• 52,350 points
1,496 views
0 votes
1 answer

Error in process execution from Nolio

Here is an approach which you can ...READ MORE

answered Jul 9, 2018 in DevOps Tools by Atul
• 10,240 points
1,089 views
+1 vote
1 answer

i have a pyhton code in my git/git repository how to build that code in jenkins

Follow these steps @Bhaskar: Step 1: Open the Jenkins ...READ MORE

answered Oct 14, 2019 in DevOps Tools by Kalgi
• 52,350 points
843 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,987 views
+2 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Logs in phoenix web app deployed using edeliver

The newer versions of edilever and distillery ...READ MORE

answered Jun 19, 2018 in DevOps Tools by ajs3033
• 7,300 points
930 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP