Back To FAQ

How to rename wwwroot folder in ASP.NET Core application?

ASP.NET Core serves static files from wwwroot folder. This is the default web root folder.

You can either rename this folder or include another folder to serve static files.

Rename wwwroot

You can rename wwwroot folder to any other name as per your choice and set it as a web root while preparing hosting environment in the program.cs.

For example, let's rename wwwroot folder to Content folder. Now, call UseWebRoot() method to configure Content folder as a web root folder in the Main() method of Program class as shown below.

public class Program
    public static void Main(string[] args)
        var host = new WebHostBuilder()


Thus, you can rename the default web root folder wwwroot as per your choice.