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