Questions tagged [razorlight]

RazorLight is a template engine based on Microsoft's Razor parsing engine for .NET Core.

Open source RazorLight is an alternative to Antaris RazorEngine , that is popular on .Net framework, but doesn’t have stable port to .Net Core(yet).

20 questions
7
votes
3 answers

Project can not find template with key _Layout.cshtml

I'm struggling to make email work while working with embedded resource for _Layout.cshtml in FluentEmail. This is the exception error I'm getting: Project can not find template with key _Layout.cshtml This is my setup so far: Inside the…
Ash K
  • 1,802
  • 17
  • 44
6
votes
0 answers

RazorLight RazorLight.TemplateNotFoundException: Project can not find template with key

I am trying to generate HTML based on a .cshtml file, which is embedded: However, from RazorLight I always get the following Exception: RazorLight.TemplateNotFoundException: Project…
bbrinck
  • 953
  • 1
  • 9
  • 33
3
votes
1 answer

How to include another razor template in a loop when using RazorLight?

I have a very simple code sample where I am trying to include a razor template in a loop, but it does not work. Please, observe: C:\temp\test> dir Directory: C:\temp\test Mode LastWriteTime Length Name ---- …
mark
  • 59,016
  • 79
  • 296
  • 580
2
votes
1 answer

RazorLight Could not load file or assembly System.Threading.AccessControl

The goal is to generate HTML from a .cshtml file When using RazorLight I get the following error: System.IO.FileNotFoundException: Could not load file or assembly 'System.Threading.AccessControl, Version=4.0.5.0, Culture=neutral,…
bbrinck
  • 953
  • 1
  • 9
  • 33
2
votes
0 answers

.Net core 3.1 After publish Antiforgery.dll was not found

I have a simple application with a ContactUs form built using .Net core 3.1. I am using Razor light package for rendering the razor template and using Fluent email api. During development, everything works fine. But as soon as I publish the app I…
Haseeb Khan
  • 930
  • 3
  • 19
  • 41
1
vote
0 answers

C# RazorLight not working when build in release

I installed in my project RazorLight. It work fine locally, but when I build it in release mode this is the error: Cannot find reference assembly 'Microsoft.AspNetCore.Antiforgery.dll' file for package Microsoft.AspNetCore.Antiforgery…
erikscandola
  • 2,854
  • 2
  • 17
  • 24
1
vote
0 answers

Rendering html as a string in RazorLight

I want to render a string so that if the string includes a "br" tag, it doesn't break the line and show br tag as text: public RazorLight.Text.RawString PrintValueOrEmpty() { if (Value == null) { return new…
tad
  • 21
  • 3
1
vote
0 answers

LinqPad - RazorLight executing from LinqPad throws "RazorLight.RazorLightException: Can't load metadata reference"

Using the awesome LinqPad which references a ClassLib which in turn executes the RazorLight engine. Physical cshtml files live in a local folder. I run into the same error: RazorLight.RazorLightException: Can't load metadata reference from the entry…
Rax
  • 665
  • 8
  • 19
1
vote
1 answer

Razor Page HTML Rendering via RazorLight.NetCore3 Template Key

I have recently integrated this RazorLight package for Razor page rendering. While using I came to notice that there is a Template key that has to be defined. What actually this template key is and what it does? var result = await…
1
vote
1 answer

RazorLight.RazorLightException in FluentEmail (2.8.0) when being used in Azure Functions

I am trying to use FluentEmail 2.8.0 in an Azure Function. However, I had the following exception. RazorLight.RazorLightException: Can't load metadata reference from the entry assembly. Make sure PreserveCompilationContext is set to true in…
Sam
  • 640
  • 5
  • 15
1
vote
0 answers

How to correctly load razor views via RazorLight - first request is pretty long

I have created following simple Razor View: EmailTemplates/Reset.cshtml: @model ResetTemplateDto Rest email @Model.Title I have called this razor view something like this (via RazorLight): I am loading Razor Views like EmbeddedResources: var engine…
Jenan
  • 3,408
  • 13
  • 62
  • 105
1
vote
1 answer

RazorLight for .Net Core how to setup encoding for DE lang

I have used RazorLight in my .Net Core project. And I need to parse Resourses.resx files with different languages. It works good for EN, but when I trying to parse DE lang(for example), I have some issues with some symbols. How can I setup correct…
Roma Pavliuk
  • 144
  • 8
1
vote
1 answer

Error: Can't load metadata reference from the entry assembly. Make sure PreserveCompilationContext is set to true in *.csproj file

This problem is specific to RazorLight. Error: Can't load metadata reference from the entry assembly. Make sure PreserveCompilationContext is set to true in *.csproj file This error pops up only after we deploy to AWS. On the local machine…
P.Brian.Mackey
  • 43,228
  • 68
  • 238
  • 348
1
vote
0 answers

RazorLight with .Net Core 2.0 WebApi System.TypeLoadException

I have followed the following link to use a Razor style syntax with my email templates; Microsoft Code Razorlight Tutorial I have implemented a static helper class for getting my templates. public static string…
Matthew Flynn
  • 3,661
  • 7
  • 40
  • 98
0
votes
0 answers

Styles not getting applied toddams/RazorLight razor engine html to PDF conversion

Used toddams/RazorLight razor engine saved web pages and converted tp pdf, used .schtml file conversion, converted webpage as string for html to pdf conversion but styles do not get applied when converted to pdf.
007ruwan
  • 89
  • 5
1
2