We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Günther Foidl • 6 years ago

Perfect! Thank you very much :-)

vassagus • 6 years ago

Worked like charm, great article. I was using RazorLight as yourself, and I was concerned about not having a stable version available. However I was also worried about the support for core 3.0, which is deprecating some stuff in flavor of RazorSDK. I also like having the views in an assembly so I can get compilation errors, I know RazorLight also supports it, but it didn't work for me very well. I believe this is the standard way of doing it, and more compatible with future core versions.

Matthew Blott • 6 years ago

I spent a solid day trying to get RazorLight working with 3.0, there's no support atm and the maintainer said he's too busy. That's how I found myself here looking for an alternative :-)

Mark McGookin • 6 years ago

Has anyone got something like this working in dotnet core 3.1? I just keep hitting issue after issue trying to get this working with the new Razor SDK

James L • 6 years ago

Hi, this is a great intro. I'm digging through the code and learning a lot about Razor.

I'm running into an issue where when I execute the page, I get this exception an null pointer exception at:
at Microsoft.AspNetCore.Mvc.Razor.RazorPageBase.get_TagHelperFactory()
at Microsoft.AspNetCore.Mvc.Razor.RazorPageBase.CreateTagHelper[TTagHelper]()
at AspNetCore.Templates_RevuLicenseTemplate.<executeasync>d__7.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at EmailGeneratorCore.EmailRazorEngine.<getoutput>d__3`1.MoveNext() in C:\Users\jlexen\source\repos\EmailGeneratorCore\EmailGeneratorCore\EmailRazorEngine.cs:line 57
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at EmailGeneratorCore.EmailRazorEngine.<renderasync>d__2`1.MoveNext() in C:\Users\jlexen\source\repos\EmailGeneratorCore\EmailGeneratorCore\EmailRazorEngine.cs:line 34
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at EmailGeneratorCore.EmailGenerator.<generateemail>d__0`1.MoveNext() in C:\Users\jlexen\source\repos\EmailGeneratorCore\EmailGeneratorCore\EmailGenerator.cs:line 17

This occurs when I add any kind of body to a page, even a page with just the following contents:
@model MyNamespace.MyModel

<html>
<body>
</body>
</html>

If I remove the Body, it works. Thoughts? There must be some kind of set up I'm missing.

Emily • 6 years ago

Are you supplying a model value in your render call? Take a look at the tests for examples of how to call render with/without a model:

https://github.com/emilol/R...

Guest • 6 years ago
Emily • 6 years ago

No sorry, I never had the requirement at the time. I can see it would be useful though for a lot of folks that want anything more than a simple template. If you do get a sample working please do share!