2016-10-10 5 views
0

エンティティフレームワークのコアリファレンスをフルフレームワークコアwebapiプロジェクトに追加しましたが、エラーが発生します。以下のスクリーンショットに示すように、Startup.csにdbコンテキストを登録しました。私は(ドットネットの実行を使用して)それを実行しようとすると、コードがエラーをスローする!エラーは以下に示されています、何か間違っているのですか?EntityFrameworkコア参照によりコンパイラエラーが発生する

多くのありがとうございました。

破断ライン

services.AddDbContext<DbContext1>(options => options.UseSqlServer(Configuration.GetConnectionString("DbContext1"))); 

エラー

>dotnet run 
Project something (.NETFramework,Version=v4.6) will be compiled because inputs were modified Compiling something for .NETFramework,Version=v4.6 

Compilation succeeded. 
0 Warning(s) 
0 Error(s) 

Time elapsed 00:00:01.4944030 


Unhandled Exception: System.Reflection.TargetInvocationException:  Exception has been thrown by the target of an invocation. ---> 

System.IO.FileLoadException: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference (Exception from HRESULT: 0x80131040) at something.Startup.ConfigureServices(IServiceCollection services) 
--- End of inner exception stack trace --- 
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke 
Attr, Binder binder, Object[] parameters, CultureInfo culture) 
at Microsoft.AspNetCore.Hosting.Internal.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection exportServices) at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices() at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication() at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at something.Program.Main(String[] args) in C:\Projects\tms-sime\src\something\Program.cs:line 15 

startup.cs file

パッケージファイル(project.json)

{ 
    "dependencies": { 
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0", 
    "Microsoft.AspNetCore.Mvc": "1.0.1", 
    "Microsoft.AspNetCore.Routing": "1.0.1", 
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", 
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", 
    "Microsoft.EntityFrameworkCore": "1.0.1", 
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.1", 
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", 
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0", 
    "Microsoft.Extensions.Configuration.Json": "1.0.0", 
    "Microsoft.Extensions.Logging": "1.0.0", 
    "Microsoft.Extensions.Logging.Console": "1.0.0", 
    "Microsoft.Extensions.Logging.Debug": "1.0.0", 
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0" 

更新

は、私はそう

enter image description here

enter image description here

+0

クリーンで再構築したとしますか? –

+0

はい私は(ビジュアルスタジオ内で) – Jamie

+0

あなたのパッケージファイルはどのように見えますか? –

答えて

0

のようなプロジェクトを作成した場合、それはまだそれは私を助けたので、私はちょうどNuGetマネージャでMicrosoft.Extensions.Loggingをアップグレードし、発生したのです。

関連する問題