Let's say I have this view:
@model App.ViewModels.Unicorn
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div id='#unicorns'>...</div>
@section Scripts {
@Scripts.Render("~/bundles/unicorns")
}
If removing the Layout
in the view will default it's layout to the one specified in the _ViewStart.cshtml
file then why is it complaining about Cannot resolve section 'Scripts'
?
EDIT: I do have my section on my layout page:
@RenderSection("scripts", required: false)
Please do note this is not case sensitive, since it's been working with the @section Scripts
uppercase 'S' and @RenderSection("scripts
lower 's'.
Even though .Net doesn't care about the case sensitivity Resharper does. Changing it to lowercase will fix the issue.
@section scripts {
@Scripts.Render("~/bundles/unicorns")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With