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?
The easiest way to create a new controller is to right-click the Controllers folder in the Visual Studio Solution Explorer window and select the Add, Controller menu option (see Figure 1). Selecting this menu option opens the Add Controller dialog (see Figure 2).
Select the EXPLORER icon and then control-click (right-click) Controllers > New File and name the new file HelloWorldController. cs . In Solution Explorer, right-click Controllers > Add > New File. Select ASP.NET Core and Controller Class.
Visual Studio Code (VS Code) allows you to create ASP.NET MVC application on Windows and Mac systems. To use C1 MVC controls, few additional steps are required to configure the project created using the Visual Studio Code IDE. Create a new folder on your system for the ASP.NET Core MVC application.
You need to select some form of authentication when you create the app.
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
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With