Can't build EntityFrameworkCore example
Posted by: Gerry Green
Date: September 25, 2016 09:28AM

Trying to follow the example in the blog post. Initially just tried to integrate the example code into a site I was building, finally gave up and tried the example verbatim (i.e. using "efcore" and cutting and pasting the code from the blog). Tried the latter on Ubuntu 16.04 that had .net core from release day, tried on Windows 10, also with .net core from release. Finally tried on a brand new 16.04 install on AWS.

In every case the build fails with the same error messages. This is from windows but I'm getting the same thing on linux:

Project efcore (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
Compiling efcore for .NETCoreApp,Version=v1.0
C:\Program Files\dotnet\dotnet.exe compile-csc @C:\Users\gerry\efcore\obj\Debug\netcoreapp1.0\dotnet-compile.rsp returned Exit Code 1
C:\Users\gerry\efcore\EmployeesContext.cs(46,10): error CS0246: The type or namespace name 'MaxLengthAttribute' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\gerry\efcore\EmployeesContext.cs(46,10): error CS0246: The type or namespace name 'MaxLength' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\gerry\efcore\EmployeesContext.cs(49,10): error CS0246: The type or namespace name 'MaxLengthAttribute' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\gerry\efcore\EmployeesContext.cs(49,10): error CS0246: The type or namespace name 'MaxLength' could not be found (are you missing a using directive or an assembly reference?)

Compilation failed.
0 Warning(s)
4 Error(s)

Time elapsed 00:00:00.7367607

If I comment out the two maxlength attributes then I get this error message instead:

C:\Users\gerry\efcore\EmployeesContext.cs(25,28): error CS1061: 'DbContextOptionsBuilder<EmployeesContext>' does not contain a definition for 'UseMySQL' and no extension method 'UseMySQL' accepting a first argument of type 'DbContextOptionsBuilder<EmployeesContext>' could be found (are you missing a using directive or an assembly reference?)

Options: ReplyQuote


Subject
Written By
Posted
Can't build EntityFrameworkCore example
September 25, 2016 09:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.