Where is the ManageUserViewModel class located?

I created a project using ASP.Net MVC 5, EF 6, and .Net 4.5.1. At some point, I needed to change the namespace in which the project is located, from "MyTestProject" to "MyRealProject".

After making these changes to the website, I now get several errors in several of my submissions. _ChangePasswordPartial.cshtml can no longer find "@model Microsoft.AspNet.Identity.ManageUserViewModel" and _SetPasswordPartial.cshtml cannot find "MyRealProject.ManageUserViewModel"

No, where in the project can you find a file containing the ManageUserViewModel class. Before I changed the namespace, it was found, but now it is not. What for? Where did he go and how do I fix it?

+6
source share
3 answers

Known issue detected: http://blogs.msdn.com/b/webdev/archive/2014/08/04/announcing-new-web-features-in-visual-studio-2013-update-3-rtm.aspx

  1. When creating the default C # ASP.NET web application from an MVC, WebAPI, or SPA with individual authentication template, the generated Views \ Account \ _SetPasswordPartial.cshtml and _ChangePasswordPartial.cshtml files contain an invalid model.

In the _SetPasswordPartial.cshtml file

@ model.Models.ManageUserViewModel Must be changed to: @ model.Models.SetPasswordViewModel

In the _ChangePasswordPartial.cshtml file,

@model Microsoft.AspNet.Identity.ManageUserViewModel Must be changed to: @ model.Models.ChangePasswordViewModel

Similar problems exist for generated VB projects.

In the _SetPasswordPartial.vbhtml file,

@ModelType ManageUserViewModel Must be changed to: @ModelType SetPasswordViewModel

In the _ChangePasswordPartial.vbhtml file,

@ModelType ManageUserViewModel Must be changed to: @ModelType ChangePasswordViewModel

Also published here: fooobar.com/questions/977991 / .... I do not know what rules with repeating questions and answers, please edit if necessary.

+10
source

_ChangePasswordPartial.cshtml should use something like

@model MyRealProject.Models.SetPasswordViewModel 

Then, make sure that the AccountViewModels.cs model folder

Namespace updated to MyRealProject .

Hope this helps.

+4
source

CRTL + SHIFT + F, then enter "ManageUserViewModel class", just this simple

make sure it is configured to search for the whole solution and it will find the class you are looking for

-3
source

Source: https://habr.com/ru/post/977989/


All Articles