Cheap ASP.NET Core 1.0 Hosting Tutorial – How To Change Startup.cs and wwwroot folder name in ASP.NET Core

Cheap ASP.NET Core 1.0 Hosting Tutorial – How To Change Startup.cs and wwwroot folder name in ASP.NET Core

CheapASPNETHostingReview.com | Best and cheap ASP.NET Core 1.0 hosting. ASP.NET Core runs on conventions. It expects Startup.cs file for starting up the ASP.NET Core application and wwwroot folder for the application’s static contents. But what if you want to change the name of Startup.cs and wwwroot to your choice? Well, that can be done. In this short post, we will see how to change Startup.cs and wwwroot folder name in ASP.NET Core.

cheap-aspnet-core-1-0-hosting_zpsk9oqwzps

Change Startup.cs class name

You can easily change the startup class name. Open the Startup.cs file and change the startup class name from Startup to “MyAppStartup” (or anything of your choice). And also change the name of the constructor.

Now you need to tell ASP.NET Core about new Startup class name, otherwise application will not start. So open Program.cs file and change the UseStartup() call as follows:

That’s it.

Change wwwroot folder name

Earlier, I posted how to rename the wwwroot folder via hosting.json file but that doesn’t seem to work now. To change the name, right on wwwroot folder and rename it to “AppWebRoot” (or anything of your choice).

Now, open Program.cs file and add highlighted line of code to Main().

That’s it.

Hope you liked it. Thank you for reading.