I am having the same issue. I have added the following dependencies in my project.json file:
"dependencies": {
"EntityFramework": "7.0.0-beta4",
"EntityFramework.Core": "7.0.0-rc1-final",
"EntityFramework.SqlServer": "7.0.0-beta8",
"EntityFramework.Commands": "7.0.0-rc1-final"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel",
"ef": "EntityFramework.Commands"
},
...
I used dnu install EntityFramework and dnu install EntityFramework.SqlServer to install the packages. "EntityFramework": "7.0.0-beta4", was written under dependencies node automatically by the installer itself.
Issue / Question 1: To my surprise when I was pulling in the intellisence for EntityFramework the available version I am presenting with is only 6.1.3!
Issue 2: When I am compiling my application using dnu build (I ran dnu restore command after adding EntityFramework assemblies (.Core and .Commands) manually under dependencies node I am getting a bunch of compilation errors:
The type 'DbContextOptionsBuilder' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null'.
D:\Projects\aspnet\apiservice\Models\SampleData.cs(12,41): DNXCore,Version=v5.0 error CS0308: The non-generic method 'IServiceProvider.GetService(Type)' cannot be used with type arguments
D:\Projects\aspnet\apiservice\Models\SampleData.cs(13,32): DNXCore,Version=v5.0 error CS0308: The non-generic method 'IServiceProvider.GetService(Type)' cannot be used with type arguments
D:\Projects\aspnet\apiservice\Models\SampleData.cs(14,29): DNXCore,Version=v5.0 error CS1061: 'object' does not contain a definition for 'Books' and no extension method 'Books' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
D:\Projects\aspnet\apiservice\Models\SampleData.cs(15,42): DNXCore,Version=v5.0 error CS1061: 'object' does not contain a definition for 'Authors' and no extension method 'Authors' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
D:\Projects\aspnet\apiservice\Models\SampleData.cs(17,43): DNXCore,Version=v5.0 error CS1061: 'object' does not contain a definition for 'Authors' and no extension method 'Authors' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
D:\Projects\aspnet\apiservice\Models\SampleData.cs(19,45): DNXCore,Version=v5.0 error CS1061: 'object' does not contain a definition for 'Authors' and no extension method 'Authors' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
D:\Projects\aspnet\apiservice\Models\SampleData.cs(22,29): DNXCore,Version=v5.0 error CS1061: 'object' does not contain a definition for 'Books' and no extension method 'Books' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
D:\Projects\aspnet\apiservice\Models\SampleData.cs(61,29): DNXCore,Version=v5.0 error CS1061: 'object' does not contain a definition for 'SaveChanges' and no extension method 'SaveChanges' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
If I remove .Core and .Commands assembly references the project build fine.
Then I changed the version for EntityFramework.Core to 7.0.0.0 as mentioned in the error:
The type 'DbContextOptionsBuilder' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework.Core, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null'.
But dnu restore now gave me the following:
Unable to locate Dependency EntityFramework.Core >= 7.0.0
Writing lock file D:\Projects\aspnet\apiservice\project.lock.json
Restore complete, 6675ms elapsed
Errors in D:\Projects\aspnet\apiservice\project.json
Unable to locate Dependency EntityFramework.Core >= 7.0.0
I am a newbie in asp.net 5 Visual Studio code platform. And I cannot use Visual Studio 2015 as other members of the dev team are using OSX.
This is a learning project for me. Requirement is pretty straight forward. Connect a SQL Server database, pull master-child relational data using Entity Framework.
Screwed up! Help!!
Thanks in advance
UPDATE
I can see the major changes in
project.jsonfor all packages with version7.0.0-rc1-final. I used Yeoman generator tool to create the project but looks like you corrected the package throughVisual Studio. So, do I have to update the package version manually andrestorethem?When the project was created/generated by Yeoman, there was no
global.jsonfile added by default. Can I add this manually and put the code inside by hand? Will this work?I can also see some additional package references are added to
project.jsonfile which were not added by default by Yeoman generator - likeMicrosoft.AspNet.Tooling.Razor,Microsoft.Extensions.Logging.Console,Microsoft.Extensions.Logging.Debug,Microsoft.Extensions.Loggingetc. Are they all being used effectively in the project? Because the generator did not add them automatically, again, can I add them manually and restore usingdnu restore? Will this have any impact on the project if I add them manually?