Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

186
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda