Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative to RazorEngine? #558

Open
GFoley83 opened this issue Sep 5, 2019 · 11 comments
Open

Alternative to RazorEngine? #558

GFoley83 opened this issue Sep 5, 2019 · 11 comments

Comments

@GFoley83
Copy link

GFoley83 commented Sep 5, 2019

Looks like this project is dead and also has some issues working with Core and some Azure services (e.g. Azure Functions).

What are people using instead?

@marko444
Copy link

marko444 commented Oct 9, 2019

https://sharpscript.net/usecases/email-templates

@GMihalkow
Copy link

GMihalkow commented Oct 15, 2019

@GFoley83 if your goal is only to compile Razor view templates, you can use this solution https://dotnetstories.com/blog/Generate-a-HTML-string-from-cshtml-razor-view-using-ASPNET-Core-that-can-be-used-in-the-c-controlle-7173969632

Helped me a lot.

@kjmtks
Copy link

kjmtks commented Oct 17, 2019

@GFoley83 I recommend RazorLight.
If you use it with .net core 3, please check it.

@matthewblott
Copy link

https://sharpscript.net/usecases/email-templates

This doesn't appear to be open source.

@matthewblott
Copy link

@GFoley83 I recommend RazorLight.
If you use it with .net core 3, please check it.

This will not work with .NET Core 3.0.

@kjmtks
Copy link

kjmtks commented Oct 23, 2019

@GFoley83 I recommend RazorLight.
If you use it with .net core 3, please check it.

This will not work with .NET Core 3.0.

Try to use version 2.0.0-beta1.

@matthewblott
Copy link

@GFoley83 that's the version I have been using

@kjmtks
Copy link

kjmtks commented Oct 25, 2019

@GFoley83 that's the version I have been using

It works in my project using .Net core 3.0 with following code:

async Task<string> Assemble(string viewString, YourModelType model)
{
  var engine = new RazorLight.RazorLightEngineBuilder()
    .UseMemoryCachingProvider().Build();
  return engine.CompileRenderAsync("somekey", viewString, model);
}

@Wingjam
Copy link

Wingjam commented Dec 16, 2019

I also switched to RazorLight using .Net Core 3.0

@jsgoupil
Copy link

jsgoupil commented Oct 15, 2020

RazorLight does not support @helper. Just FYI.

@jsgoupil
Copy link

After a long research. @helper is simply not available in .NET Core 3 but you can go around it.

But I found myself going with this:
https://github.com/EtiennePeeters/AzureFunctionsRazorEmailTemplateSample

I was able to run the out of the box Razor in an Azure Function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants