在某些时候,我需要更改项目所在的命名空间,从“MyTestProject”更改为“MyRealProject”.
在整个网站上进行这些更改之后,我现在在几个视图中遇到了一些错误.
_ChangePasswordPartial.cshtml再也找不到“@model Microsoft.AspNet.Identity.ManageUserviewmodel”而且_SetPasswordPartial.cshtml找不到“MyRealProject.ManageUserviewmodel”
在项目的哪个位置,我找不到包含类ManageUserviewmodel的文件.在我更改命名空间之前,它已找到,但现在却没有.为什么?它去了哪里,我该如何解决?
解决方法
http://blogs.msdn.com/b/webdev/archive/2014/08/04/announcing-new-web-features-in-visual-studio-2013-update-3-rtm.aspx
- When creating a default C# ASP.NET Web Application from MVC,WebAPI or SPA template with individual authentication,generated Views\Account\ _SetPasswordPartial.cshtml and _ChangePasswordPartial.cshtml files contain invalid model.
In file _SetPasswordPartial.cshtml,
@model .Models.ManageUserviewmodel
Should be changed to:
@model .Models.SetPasswordviewmodelIn file _ChangePasswordPartial.cshtml,
@model Microsoft.AspNet.Identity.ManageUserviewmodel
Should be changed to:
@model .Models.ChangePasswordviewmodelSimilar problems exist for generated VB projects as well.
In file _SetPasswordPartial.vbhtml,
@ModelType ManageUserviewmodel
Should be changed to:
@ModelType SetPasswordviewmodelIn file _ChangePasswordPartial.vbhtml,
@ModelType ManageUserviewmodel
Should be changed to:
@ModelType ChangePasswordviewmodel
也发布在这里:https://stackoverflow.com/a/27687882/1071698.我不知道有重复问题和答案的规则是什么,请根据需要进行编辑.