Errors with the new MVC5 project in Visual Studio 2013.3

Wonder if anyone else experienced this and what their solution was, if so. In Visual Studio 2013, I create a new ASP.NET web application, leaving all the defaults as they are

On the next screen, I select MVC, adding folders and main links for MVC, but not the other two options. Authentication remains in the Individual user accounts , and I disabled the Host option in the cloud, as shown below.

Initial post new project screen

The project wizard ends and I see that there are 26 errors in it before I do anything else.

The first fix that removes a bunch of these errors is that the Views\Account\ _SetPasswordPartial.cshtml and _ChangePasswordPartial.cshtml contain invalid models, so I change them as follows:

[My project name is WebApplication1, replace your own value]

In _SetPasswordPartial.cshtml: From @model WebApplication1.Models.ManageUserViewModel to @model WebApplication1.Models.SetPasswordViewModel

In the _ChangePasswordPartial.cshtml file: From @model Microsoft.AspNet.Identity.ManageUserViewModel for @model WebApplication1.Models.ChangePasswordViewModel

It reduces to 4 errors, spreads over 4 files

1. Line 68, ManageController.cs

 return View(linkedAccounts); 

View RemoveLogin does not exist

2.3. There are two errors, _SetPasswordPartial.cshtml and _ChangePasswordPartial.cshtml , complaining about the inability to allow the Control action, but when I debug and visit these URLs in the browser, they work fine, so I suspect that they are somewhere in the route table . I installed R # so sometimes that it might be wrong if this is the case.

4. The latter is that _RemoveAccountPartial.cshtml has an error on line 15 where it complains that it does not have the Disassociate action in the account controller, as far as I can see, this is due to the removal of other authentication applications in the application.

Now I can fix all this by adding the required code, but it just doesnโ€™t suit me that the templates do not work out of the box. Are new templates available or did someone make a canonical record of how to get your template to hum before starting to work on it?

EDIT 2014-11-13 I just applied VS2013.4, and these problems seem to be fixed as part of this. If this is a problem for people, I suggest applying this update.

+4
source share
3 answers

I donโ€™t know what is the cause of these problems, but after playing with the project it seems to lead to a consistent state:

  • Delete Views\Account\_SetPasswordPartial.cshtml
  • Delete Views\Account\_ChangePasswordPartial.cshtml
  • Delete Views\Account\_RemoveAccountPartial.cshtml

All of them have analogues with the Manage controller. And finally:

  1. Remove the RemoveLogin() action method from the ManageController . Make sure that you only remove the GET method (lines 64 - 69), as POST is actually used. The list of logins is displayed by the ManageLogins action.
+6
source

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

+2
source

I also confirmed the problem in VS2013 Ultimate Update # 3. I submitted a bug report in Microsoft Connect in the Visual Studio and .NET Framework section.

-3
source

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


All Articles