RazorLight icon indicating copy to clipboard operation
RazorLight copied to clipboard

Add Razor Class Library sample

Open knuxbbs opened this issue 4 years ago • 5 comments

Is your feature request related to a problem? Please describe. There isn't any sample using cshtml files, only strings. I think that the majority of users come to this repo to found a solution that uses the capabilities of Razor views and pages.

Describe the solution you'd like Create a project which uses a Razor Class Library to share templates with another project.

knuxbbs avatar Nov 24 '20 13:11 knuxbbs

I've tried to create a sample here, but without success: https://github.com/knuxbbs/RazorLightSample

knuxbbs avatar Nov 24 '20 13:11 knuxbbs

@knuxbbs Can you elaborate on what you mean "without success"? Then I will start poking around. Thanks.

jzabroski avatar Nov 25 '20 16:11 jzabroski

Well, I got it with the help of @maxbanas in https://github.com/toddams/RazorLight/issues/378#issuecomment-732994641.

But do you think there should an example with cshtml files in the samples folder? If not, you can close this issue.

knuxbbs avatar Nov 25 '20 19:11 knuxbbs

@knuxbbs I definitely want to add samples for various scenarios, like hosting a net48 WPF app. That would cover some scenarios.

The reason I want to add samples is a lot of people find out about RazorLight from blog posts that may or may not have the best practices. Unfortunately, GitHub doesn't give me Google Analytics type insights to see what's driver traffic, and neither does Nuget. If it did, I could probably contact blog authors and ask them to amend blog posts with some incorrect practices.

jzabroski avatar Nov 25 '20 20:11 jzabroski

A while back i write the following, which is something we are using within our company. Note that this however still uses an old release, however it should work on the new ones as well. https://github.com/Vincentvwal/RazorLightExample

This also comes with the following guide (also, not updated for now) https://vincentvwal.github.io/razorlight/templates/razor/email/2020/11/18/Adding-an-email-library-in-.Net-Standard-2.1-with-Razor-templates.html

This isn't really using RCL, but the main reason behind that is that when i included razorLight within RCL, my visual studio stopped working.

Vincentvwal avatar Nov 30 '20 09:11 Vincentvwal