Questions tagged [razor-class-library]

81 questions
14
votes
2 answers

Blazor - Razor class library - reuse full blazor page

I am having a problem here, I created a Blazor app (server side) with core 3.1, then I created a Razor class library (old razorlib) with this classlib I can create blazor comp and reuse in my blazor app < myComp >, share Css even create full Razor…
11
votes
1 answer

Is it possible to create Blazor pages inside RCL?

This page explains how to create a Razor class library where to put shared components. I've tried to create a sample Blazor Server-Side project where its index.razor has a component that is defined inside the Razor class library. It works. What I…
7
votes
3 answers

Blazor server .NET6 Razor Class Library assets 404 error

I have a Razor Class Library that I've been using for months with .NetCore3 then .NetCore 5 without a problem. After recently updating our blazor server application and our Razor Class Library to .NetCore 6 I've hit a problem loading the assets from…
Mark Cooper
  • 6,738
  • 5
  • 54
  • 92
6
votes
5 answers

404 with static content in Razor Class Library (RCL)

I am having difficulties implementing static files in razor class library (.net Core 3.1) that are consumed by an ASP.NET Core (v3.1) application. When trying to access the static files, I only get an 404 - Not Found. I followed the following answer…
6
votes
2 answers

Razor Class Library Adding reference to css, js to main projeto master

Is there a way to when creating a Razor class library and in there you have js, css it will automatically add the reference links in _Host.cshtml from Blazor app? making it short I do not want to add a reference for my Css/js from my razor class…
Douglas Simão
  • 259
  • 3
  • 8
5
votes
1 answer

Consuming a Razor Class Library with Partial Views in .Net Framework Project

I have recently come across Razor Class Libraries and am not 100% sure of what can / can't be achieved with them, but am very much liking the concept of being able to create views (and partial views) which can be shared within multiple web…
Jamie Hartnoll
  • 7,231
  • 13
  • 58
  • 97
5
votes
0 answers

IntelliSense not working for CSS files in .NET Core 3.1 Razor Class Library when accessed from referencing web applications

I am creating a reusable UI utilizing a .NET Core 3.1 Razor Class Library (RCL) as documented here: https://learn.microsoft.com/en-us/aspnet/core/razor-pages/ui-class?view=aspnetcore-3.1&tabs=visual-studio I am able to create an RCL that includes…
Shawn Paige
  • 338
  • 1
  • 8
5
votes
0 answers

Razor Class Library which uses the dbcontext of the main web application

I try to create a Razor Class Library which I will be able to use in various projects. I need the Razor Class Library to have it’s own entity framework entities. I want to set up the solution somehow so that the Razor Class Library will use the…
4
votes
1 answer

Reference directly a Razor Class Library assembly

I'm working on a web application where pages need to be populated from other projects. I was hoping to use a Razor Class Library (RCL) for that. The documentation states that a RCL can be referenced only as a project reference or a nuget package. I…
Kevin Gosse
  • 38,392
  • 3
  • 78
  • 94
4
votes
1 answer

Creating Razor Class Library with TargetFramework to .net core 3 throws errors

I am creating an ASP.Net Core 3 pre-release 9 MVC app and I want to create some Razor Class Libraries (RCL). When creating a RCL from the template it will default to targeting netstandard2.0 which is indeed not possible for .Net Core 3 anymore…
Twenty
  • 5,234
  • 4
  • 32
  • 67
3
votes
1 answer

Razor Runtime Compilation doesn't work with dynamically loaded assembly

I can't get Razor Runtime Compilation to work with a dynamically loaded assembly. My code: Startup.cs var assembly = Assembly.LoadFrom(someModuleDllPath); var viewsAssembly =…
rafalxyz
  • 159
  • 1
  • 6
3
votes
2 answers

Move component's Dependency Injected methods to separate CS library in Blazor Server-Side

Would like to make reusable functions/methods in separate .cs files and/or in a separate library. Of course i know how to do this, my problem is i don't know how to do this in the case where i need to use dependency injected elements. For example,…
3
votes
2 answers

Add client-side library to Razor Class Library

I am learning Blazor and I noticed it is a nice practice to create Razor Class Library where you are going to define majority of your components so you can use those either in client or server without too much issues. In different frameworks I've…
AlexanderM
  • 1,613
  • 4
  • 21
  • 35
3
votes
1 answer

Nuget package content files not served when deployed

I have build NuGet package consisting of Razor Class Library (RCL) project at .net core 2.2. Once packed I see that it contains static assets that I have configured: When I install package inside target project, assets refs are visible inside…
IT Man
  • 933
  • 3
  • 12
  • 33
3
votes
3 answers

Using Razor Templates Stored in Razor Class Library 3.0 (RCL) Without AspNetCore Web Application

I am using Razor templates (cshtml) to build HTML for use in emails. While I can get this all to work and I can send email from a ASPNetCore 3.0 web application I want to actually send email from another process which is NOT a web application.…
1
2 3 4 5 6