Application not auto creating AccountController
Asked Answered
B

4

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?

Bratton answered 22/4, 2017 at 19:5 Comment(2)
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?Nomadic
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!Bratton
N
16

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

enter image description here

Nomadic answered 22/4, 2017 at 22:44 Comment(0)
A
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.

Abut answered 1/8, 2018 at 13:17 Comment(0)
G
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

Gaiety answered 26/10, 2018 at 3:55 Comment(0)
O
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
Orndorff answered 7/7, 2019 at 10:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.