You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I want to use Layout but with embedded resources.
Currenlty, I use RazorLight without layouts. It works.
My current code is
internal static string GenerateHtml<T>(string resourceName, T model)
{
var engine = new RazorLightEngineBuilder()
.UseEmbeddedResourcesProject(typeof(RootTypeForEmbeddedResources).Assembly, typeof(RootTypeForEmbeddedResources).Namespace)
//.AddDynamicTemplates(new Dictionary<string,string>()
//{ {"_Layout.cshtml","<body>Test\r\n @RenderBody()\r\n</body>" }}
//)
.SetOperatingAssembly(operatingAssembly)
.UseMemoryCachingProvider()
.EnableDebugMode()
.Build();
string html = engine.CompileRenderAsync<T>(resourceName, model).Result;
return html;
}
I test, if I use AddDynamicTemplates (commented code), it works too.
No I want to have a file "_Layout.cshtml" which is an embedded ressource.
Currently if I do nothing, I have the following Exception : "One or more errors occurred. (RazorLightProjectItem of type RazorLight.Razor.EmbeddedRazorProjectItem with key _Layout.cshtml could not be found by the RazorLightProject of type RazorLight.Razor.EmbeddedRazorProject and does not exist in dynamic templates. See the "KnownDynamicTemplateKeys" and "KnownProjectTemplateKeys" properties for known template keys.) ---> RazorLight.TemplateNotFoundException: RazorLightProjectItem of type RazorLight.Razor.EmbeddedRazorProjectItem with key _Layout.cshtml could not be found by the RazorLightProject of type RazorLight.Razor.EmbeddedRazorProject and does not exist in dynamic templates. See the "KnownDynamicTemplateKeys" and "KnownProjectTemplateKeys" properties for known template keys."
And KnownDynamicTemplateKeys is empty, and KnownProjectTemplateKeys does not contains my "_Layout.cshtml"
Describe the solution you'd like
Several solutions :
1°/ Create a "UseEmbeddedResourcesTemplate" like "UseEmbeddedResourcesProject"
2°/ Create a AddDynamicTemplatesFromResources
...
Additional context
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I want to use Layout but with embedded resources.
Currenlty, I use RazorLight without layouts. It works.
My current code is
I test, if I use AddDynamicTemplates (commented code), it works too.
No I want to have a file "_Layout.cshtml" which is an embedded ressource.
Currently if I do nothing, I have the following Exception : "
One or more errors occurred. (RazorLightProjectItem of type RazorLight.Razor.EmbeddedRazorProjectItem with key _Layout.cshtml could not be found by the RazorLightProject of type RazorLight.Razor.EmbeddedRazorProject and does not exist in dynamic templates. See the "KnownDynamicTemplateKeys" and "KnownProjectTemplateKeys" properties for known template keys.) ---> RazorLight.TemplateNotFoundException: RazorLightProjectItem of type RazorLight.Razor.EmbeddedRazorProjectItem with key _Layout.cshtml could not be found by the RazorLightProject of type RazorLight.Razor.EmbeddedRazorProject and does not exist in dynamic templates. See the "KnownDynamicTemplateKeys" and "KnownProjectTemplateKeys" properties for known template keys.
"And KnownDynamicTemplateKeys is empty, and KnownProjectTemplateKeys does not contains my "_Layout.cshtml"
Describe the solution you'd like
Several solutions :
1°/ Create a "UseEmbeddedResourcesTemplate" like "UseEmbeddedResourcesProject"
2°/ Create a AddDynamicTemplatesFromResources
...
Additional context
The text was updated successfully, but these errors were encountered: