I wanted to do EntityFramework work inside a seperate class library project (with name AbsenceRequests.Data.EF
) so that it can be maintained seperately.
I run into some issues with the project.json system, currenlty it looks like this:
{
"version": "1.0.0-*",
"description": "AbsenceRequests.Data.EF Class Library",
"authors": [ "authorName" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"netcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
},
"dependencies": {
"EntityFramework.Commands": "7.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final"
}
}
When I run dnx ef
on the command line, I recieve following error:
C:\...\AbsenceRequests\AbsenceRequests.Data.EF>dnx ef
System.InvalidOperationException: The current runtime target framework is not compatible with 'AbsenceRequests.Data.EF'.
Current runtime target framework: 'DNX,Version=v4.5.1 (dnx451)'
Version: 1.0.0-rc1-16202
Type: Clr
Architecture: x86
OS Name: Windows
OS Version: 6.1
Runtime Id: win7-x86
Please make sure the runtime matches a framework specified in project.json
bij Microsoft.Dnx.ApplicationHost.DefaultHost.GetEntryPoint(String applicatio
nName)
bij Microsoft.Dnx.ApplicationHost.Program.ExecuteMain(DefaultHost host, Strin
g applicationName, String[] args)
bij Microsoft.Dnx.ApplicationHost.Program.Main(String[] args)
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetrede
n ---
bij System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bij Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly
, String[] args, IServiceProvider serviceProvider)
bij Microsoft.Dnx.Host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment
env, String appBase, FrameworkName targetFramework)
bij Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, Bootst
rapperContext bootstrapperContext)
bij Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, Bootstrappe
rContext bootstrapperContext)
When I use a regular Web project (even from scratch) this works well.. But with a class library project, this fails. Any ideas anyone? What am I doing wrong?
Thanks Yves
I came across this problem myself, I resolved by adding the following to the project.json.
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
This was set to net451 when I initially created the class library project and changing it to dnx451. Therfore making sure it knew what versions of what frameworks this project was to use.