2

我在Windows 10 運行Visual Studio 2015年,這是我project.json和global.json實體框架7逆向工程不起作用

{ 
    "version": "1.0.0-*", 
    "description": "Application.Data Class Library", 
    "authors": [ "------" ], 
    "tags": [ "" ], 
    "projectUrl": "", 
    "licenseUrl": "", 

    "frameworks": { 
    "dnx451": { 
    } 
    }, 
    "dependencies": { 
    "EntityFramework.SqlServer": "7.0.0-rc1-15886", 
    "EntityFramework.Commands": "7.0.0-rc1-15945", 
    "EntityFramework.Core": "7.0.0-rc1-15945", 
    "EntityFramework.SqlServer.Design": "7.0.0-rc1-15886" 
    }, 

    "commands": { 
    "ef": "EntityFramework.Commands" 
    } 
} 

{ 
    "projects": [ "Application.Data", "Application.WebApi" ], 
    "sdk": { 
    "version": "1.0.0-rc1-16048", 
    "runtime": "clr", 
    "architecture": "x86" 
    } 
} 

當我運行DNX EF我得到這個消息的錯誤

C:\Users\-------\Documents\Visual Studio 2015\Projects\Application\Application.Data>dnx ef --help 
System.InvalidOperationException: No service for type 'Microsoft.Dnx.Runtime.IRuntimeEnvironment' has been registered. 
    à Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) 
    à Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService[T](IServiceProvider provider) 
    à Microsoft.Data.Entity.Commands.Program..ctor(IServiceProvider dnxServices) 

回答

3

對DNX版本rc1-16048爲t他最新的,但你使用舊版本的EF(和衝突版本)。另外,SqlServerhas been renamedMicrosoftSqlServerThe latest versions as of this writing are:

"EntityFramework.Commands": "7.0.0-rc1-16147", 
"EntityFramework.Core": "7.0.0-rc1-16147", 
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-16147", 
"EntityFramework.MicrosoftSqlServer.Design": "7.0.0-rc1-16147" 
+0

謝謝你,救救我吧。 – Amine