toddams / RazorLight

Template engine based on Microsoft's Razor parsing engine for .NET Core
Apache License 2.0
1.51k stars 261 forks source link

Finding Views in an included class library #362

Closed tpspencer closed 4 years ago

tpspencer commented 4 years ago

I am using RazorLight in a .net core 3.1 console app. Everything is working great. I decided to move my Views to a class library, but the "await IncludeAsync" method can not find the views.

Here is the solution structure sln:RazorLightStandAlone consoleApp: ConsoleNetCore\Views classLib: BondPrint\Views

For views in ConsoleNetCore, this works great:

@{ await IncludeAsync("Views.RatingsBond.cshtml", Model); }

For views in the BondPrint class lib, these do not work:

@{ await IncludeAsync("ConsoleNetCore.BondPrint.Views.TopDetails2.cshtml", Model); } @{ await IncludeAsync("BondPrint.Views.TopDetails2.cshtml", Model); }

How do I access views in a class library of the solution?

Thank you.

tpspencer commented 4 years ago

I have figured it out. Usually happens after you post a message for help.

Thanks for the great project.

jzabroski commented 4 years ago

@tpspencer https://github.com/toddams/RazorLight#embeddedresource-source

jzabroski commented 4 years ago

Great. Thank you for closing. Happy jamming away to RazorLight. All credit goes to @toddams for slaving over this project for years.