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!

 

posted @ 2022-12-08 10:40  ChuckLu  阅读(24)  评论(0)    收藏  举报