0
我只是創造了新的asp.net 1.1核心的Web應用程序,添加的NuGet包asp.net核心FileNotFoundException異常新鮮項目
Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.SqlServer
,並引用我的其他項目
MySolution.Core
MySolution.Models
MySolution.Utilities
如果我繼續HomeController的作爲它被創建,樣本網站運行良好。 但當我下面的代碼添加到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