Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

188
Views
Razor WebApp doesn't load css when plugged as middleware to WebApi project

I'd like to create razor app, which can be plugged into another .net web application. I successfully made it, but razor project doesn't load static files like *.css and *.js, so page looks ugly with pure html. The wwwroot and another folders are unreachable in browser. How can i isolate css and js files within razor app?

Also github link to default projects with minimal changes. link non actual, please look at answer https://github.com/ShockThunder/RoseQuartz

//Code from pluggable razor app
//Extension methods to add razor app
public static IServiceCollection AddRoseQuartz(this IServiceCollection services)
{
     services.AddRazorPages();
     return services;
}

//Another to include routing and static files
public static IApplicationBuilder UseRoseQuartz(this IApplicationBuilder builder)
{
    builder.UseStaticFiles();
    builder.UseRouting();
    builder.UseEndpoints(endpoints => { endpoints.MapRazorPages(); });
    return builder;
}
//Code from main project
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
    services.AddRoseQuartz();
    services.AddControllers();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    app.UseRoseQuartz();
    //another Startup code
} 
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

So, after some days of investigation, I found this question. Can Razor Class Library pack static files (js, css etc) too?

Ehsan Mirsaeedi provided a working way to embed static files into RCL and it works for my project. Here is a link to answer https://stackoverflow.com/a/53024912.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!