ASP.NET MVC core dependencies have been added to the project. (These dependencies include packages required to enable scaffolding)
However you may still need to do make changes to your project.
-
Suggested changes to Startup class:
1.0 Configure Database connection in appsettings.json By default it uses MSSQL, If you are using MYSQL update the settings and set the default to MYSQL.
1.1 Add a constructor: public IConfiguration Configuration { get; }
public Startup(IConfiguration configuration) { Configuration = configuration; }
1.2 Add MVC services: public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); }
1.3 Configure web app to use use Configuration and use MVC routing:
public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }