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)
モデルプロジェクト参照エンティティフレームワークパッケージです。
このエラーを修正するにはどうすればよいですか?
あなたのホームコントローラにはどのような特定のコードを追加しましたか?あなたはそこにあったものを上記のコードに置き換えましたか? – Jhorra
設定方法でMyRepositoryのDIをやりましたか? – Alexan
MyRepositoryクラス、IMyRepositoryインターフェイスのコードとDIの操作方法を追加してください。 – Alexan