404 on _content/Syncfusion.Blazor/styles/bootstrap4.css

404 on _content/Syncfusion.Blazor/styles/bootstrap4.css

We request you to check the above sample in your machine and revert us whether you can reproduce the same in this sample. “_content” is the staticwebassets of the Syncfusion Blazor package reference as per the Blazor standards that you can refer from the below link. 

 

 
 

Static assets in Razor class libraries

Razor class libraries can now include static assets like JavaScript, CSS, and images. These static assets can then be included in ASP.NET Core apps by referencing the Razor class library project or via a package reference.

To include static assets in a Razor class library add a wwwroot folder to the Razor class library and include any required files in that folder.

When a Razor class library with static assets is referenced either as a project reference or as a package, the static assets from the library are made available to the app under the path prefix _content/{LIBRARY NAME}/. The static assets stay in their original folders and any changes to the content of static assets in the Razor class libraries are reflected in the app without rebuilding.

When the app is published, the companion assets from all referenced Razor class libraries are copied into the wwwroot folder of the published app under the same prefix.

 

To try out using static assets from a Razor class library:

  1. Create a default ASP.NET Core Web App.

    dotnet new webapp -o WebApp1
  2. Create a Razor class library and reference it from the web app.

    dotnet new razorclasslib -o RazorLib1
    dotnet add WebApp1 reference RazorLib1
  3. Add a wwwroot folder to the Razor class library and include a JavaScript file that logs a simple message to the console.

    cd RazorLib1
    mkdir wwwroot

    hello.js

    console.log("Hello from RazorLib1!");
  4. Reference the script file from Index.cshtml in the web app.

    <script src="_content/RazorLib1/hello.js"></script>
  5. Run the app and look for the output in the browser console.

    Hello from RazorLib1!

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(18)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2021-12-08 Difference between pem, crt, key files
2021-12-08 Does RSA Private key always contain the Public key, or is it just .NET?
2021-12-08 Extract public/private key from PKCS12 file for later use in SSH-PK-Authentication
2021-12-08 What is PEM Format? Privacy Enhanced Mail
2021-12-08 HttpWebRequest client authentication with cert and key in pem format
2021-12-08 Converting PKCS#12 certificate into PEM using OpenSSL
2017-12-08 kentico7中设置网站的主页
点击右上角即可分享
微信分享提示