Search code examples
asp.net-mvc-3razormvc-mini-profiler

_MINIPROFILER UPDATED Layout.cshtml Razor problems


What is "_MINIPROFILER UPDATED Layout.cshtml" and why does it keep giving me problems why I try to build?

"The name 'ViewBag' does not exist in the current context" _MINIPROFILER UPDATED Layout.cshtml

"The name 'Url' does not exist in the current context" _MINIPROFILER UPDATED Layout.cshtml

I didn't generate these views so I don't know how to control what's in them. Must be an easy answer out there.


Solution

  • The '_MINIPROFILER UPDATED Layout.cshtml' file is generated when you add MiniProfiler to your project through NuGet. It's an example file; it shows how you might render the MiniProfiler includes (css og js) in your layout. You should grab the @MiniProfiler.RenderIncludes() line and put it into your standard layout file (_Layout.cshtml), then delete the '_MINIPROFILER UPDATED Layout.cshtml' file.