Wondering if anyone else has 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
In the next screen I pick MVC, adding folders and core references for MVC but not the other two options. Authentication is left at Individual User Accounts and I've unchecked the Host in the cloud option, as shown below.
The project wizard completes and I can 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 files contain invalid models so I change those as follows:
[My project name here is WebApplication1, substitute your own value]
@model WebApplication1.Models.ManageUserViewModel to
In file _ChangePasswordPartial.cshtml:
From @model Microsoft.AspNet.Identity.ManageUserViewModel to @model WebApplication1.Models.ChangePasswordViewModel
That drops me down to 4 errors, spread across 4 files
Line 68, ManageController.cs
The view RemoveLogin doesn't exist
There are two errors
_ChangePasswordPartial.cshtml complaining about not being able to resolve the Manage action but when I debug and visit those URLs in the browser they work fine so I suspect they're in a route table somewhere. I have R# installed so sometimes that can be wrong if that's the case.
The last one is that the
_RemoveAccountPartial.cshtml has an error on line 15 where it complains about not having a Disassociate action in the Account controller, as far as I can ascertain this is to do with removing other authentication providers to the application.
Now I can fix all these by adding the required code but it just doesn't sit well with me that the templates don't work well out of the box. Are there fresh templates available or has anyone done the canonical write-up on how to get your template humming before you commence work properly on it?
I've just applied VS2013.4 and these issues appear to be fixed as part of it. If this is an issue for people then I suggest applying that update.
I do not know what is the root cause of these problems but after playing with the project the following seems to bring it to a consistent state:
All these have counterparts under the
Manage controller. And finally:
RemoveLogin()action method from
ManageController. Make sure you only remove the GET method (lines 64 - 69), as the POST one is actually used. The list of logins is rendered by
Found out it's a known problem: 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.SetPasswordViewModel
In file _ChangePasswordPartial.cshtml,
@model Microsoft.AspNet.Identity.ManageUserViewModel Should be changed to: @model .Models.ChangePasswordViewModel
Similar problems exist for generated VB projects as well.
In file _SetPasswordPartial.vbhtml,
@ModelType ManageUserViewModel Should be changed to: @ModelType SetPasswordViewModel
In file _ChangePasswordPartial.vbhtml,
@ModelType ManageUserViewModel Should be changed to: @ModelType ChangePasswordViewModel
I confirmed issue also in VS2013 Ultimate Update#3. Submitted bug report to Microsoft Connect under Visual Studio and .NET Framework section.