2017-05-26 19 views
0

は、nugetパッケージに私の他のプロジェクトasp.netコアにFileNotFoundException新鮮なプロジェクト

MySolution.Core 
MySolution.Models 
MySolution.Utilities 

Microsoft.EntityFrameworkCore 
Microsoft.EntityFrameworkCore.SqlServer 

と参照を追加しますそれは作成され、サンプルサイトは正常に実行されます。 しかし、私は、私はアプリの実行中にエラーを取得にHomeController

public class HomeController : Controller 
{ 
    private readonly MyRepository _repository; 

    public HomeController(MyRepository repository) 
    { 
     _repository = repository; 
    } 
    public async Task<IActionResult> Index() 
    { 
     return View(); 
    } 
} 

を次のコードを追加します。要求の処理中に 未処理の例外が発生しました。

FileNotFoundException: Could not load file or assembly 'MySolution.Models, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. 

System.Signature.GetSignature(Void* pCorSig, int cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType) 

モデルプロジェクト参照エンティティフレームワークパッケージです。

このエラーを修正するにはどうすればよいですか?

+0

あなたのホームコントローラにはどのような特定のコードを追加しましたか?あなたはそこにあったものを上記のコードに置き換えましたか? – Jhorra

+0

設定方法でMyRepositoryのDIをやりましたか? – Alexan

+0

MyRepositoryクラス、IMyRepositoryインターフェイスのコードとDIの操作方法を追加してください。 – Alexan

答えて

0

DI設定がありませんでした。

Startup.csを使用して依存関係を設定する

関連する問題