Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

How do you import a Razor page from a RCL you got from a NuGet package?

$
0
0

RCL stands for Razor class library.

I made my own prototype RCL with a Shared file _Layout.cshtml and I want to include it in my project. I already installed the RCL from NuGet hoping it would automagically work, but it apparently doesn't.

I deleted my _Layout.cshtml, hoping it would get taken from the RCL I made, but apparently that won't work like that. I get the following errors:

An unhandled exception occurred while processing the request.InvalidOperationException: The layout view '_Layout' could not be located. The following locations were searched:/Pages/_Layout.cshtml/Pages/Shared/_Layout.cshtml/Views/Shared/_Layout.cshtmlMicrosoft.AspNetCore.Mvc.Razor.RazorView.GetLayoutPage(ViewContext context, string executingFilePath, string layoutPath)
  • How do I properly import this RCL into my new web app?

Update

I added @using libnamehere to my _ViewImports.cshtml file but now I get the following errors:

InvalidOperationException: RenderBody has not been called for the page at '/Pages/Shared/_Layout.cshtml'. To ignore call IgnoreBody().Microsoft.AspNetCore.Mvc.Razor.RazorPage.EnsureRenderedBodyOrSections()

Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>