12

I am creating an MVC project in VS2017 and in VS2015, when you create an MVC templated ASP.NET Web App, it will automatically build an account controller for you which adds register and log in functionality. It will add an AccountController.cs and ManageController.cs to controllers with the appropriate views.

But in VS2017, when I create an MVC project it doesn't add this to the project. I've tried importing the files from an old VS2015 project, but It didn't seem to work. How can I get around this? Is there a way to create a project with the account controller or did they remove that in VS2017?

CodeNotFound
  • 22,153
  • 10
  • 68
  • 69
MJohnston
  • 197
  • 3
  • 11
  • 1
    I just created an MVC application and the "individual accounts" option for authentication and the `AccountController` file is there. Did you select some form of authentication when you created the app? – Maria Ines Parnisari Apr 22 '17 at 19:21
  • 1
    That was exactly my problem, I wasn't changing the authentication so there was none selected. I made a new project with "individual accounts" selected and the account controller is created. Thanks for pointing that out for me, my issue is now resolved! – MJohnston Apr 22 '17 at 19:30

4 Answers4

16

You need to select some form of authentication when you create the app.

enter image description here

Maria Ines Parnisari
  • 16,584
  • 9
  • 85
  • 130
1

My issue/resolution was slightly different than the accepted answer. I was choosing the "Web API" template while checking the "MVC" checkbox and I DID select Individual User Accounts, but the account controller/views were still not created. It appears the Account boilerplate doesn't get generated with the Web API option, regardless of what you choose for Authentication.

Ageonix
  • 1,748
  • 2
  • 19
  • 32
1

Had this problem myself today creating an ASP.NET Core Web Application with identity. changing the version from ASP.NET Core 2.1 to ASP.NET Core 2.0 fixed the problem. I am using visual studio version 15.7.6, .NET Framework version 4.7.03056

Rowan Berry
  • 171
  • 7
1

You can easily execute this command in the nuget console and your problem will be solved:

Install-Package Microsoft.AspNet.Identity.Samples -Version 2.2.0-alpha1
Md.Sukel Ali
  • 2,987
  • 5
  • 22
  • 34