简体   繁体   中英

How to define the HTML file extension in Visual Studio?

My project does not recognize the css and other files in the html files I have created, although I have written the extension paths correctly. How can I fix? 在此处输入图像描述

在此处输入图像描述

You did not put the correct path there. Your "style.css" is in 'theme/src/style.css' not in the 'theme/style.css'. Also use VS Code not Visual Studio because is useless if you create just files. Also you did not provide all the files that are in the JS folder and CSS folder.

First of all you need to configure serving static files in Startup

app.UseStaticFiles(); //serves wwwroot by default

To serve your theme folder you need to add the following lines

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM