2

I use .net core with Angular Cli, so the default structure of ngx is:

dist/project_name/index.html
src/index.html

and so on.

I need to change the default path from wwwroot to

wwwroot/dist/project_name/

How do I change the default path of index.html in .net core?


Actually, I'm willing to set two path variables with .net for dev and prod modes and change it for using it with both ngx modes ng serve and ng build. Maybe you can advice me some best practice how can I do it.

1 Answer 1

1

In the Configure Method in startup you could provide StaticFileOptions like this:

    app.UseStaticFiles(new StaticFileOptions
{
    FileProvider = new PhysicalFileProvider(
        Path.Combine(Directory.GetCurrentDirectory(), "MyStaticFiles")),
    RequestPath = "/StaticFiles"
});

Further reading: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-2.1

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.