asp.net - ASP .Net MVC 应用程序
问题描述
我正在尝试编写一个简单的 ASP.NET MVC 应用程序。但最后,在将视图添加到操作结果中时,我遇到了一个问题。我附上了控制器文件的代码片段和错误消息。
错误信息是:
运行所选代码生成器时出错:获取类型“PracticeMVC.Models.myc,Models.DataClasses1.designer.cs.dll,版本=0.0.0.0,文化=中性,PublicKeyToken = null”时出错。尝试重建项目。
我应该遵循哪些步骤来修复此错误?
控制器DataLogicController.cs
:
public ActionResult AddCustomer(int p, string q, string r)
{
DataLogic obj = new DataLogic();
obj.InsertData(p, q, r);
return View();
}
public ActionResult UpdateCustomer(int p, string q, string r)
{
DataLogic obj = new DataLogic();
obj.UpdateData(p,q,r);
return View();
}
public ActionResult DeleteCustomer(int p)
{
DataLogic obj = new DataLogic();
obj.DeleteData(p);
return View();
}
解决方案
在这种情况下,首先,从参考中删除 mvc.dll。接下来重新安装 asp .net mvc 包,然后清理应用程序解决方案,最后构建解决方案并将视图添加到操作结果。