Using @Sections in Compiled Views

May 29, 2012 at 7:37 PM
Edited May 29, 2012 at 7:38 PM

I just tried putting a section in my compiled view.  There is no layout page in the DLL project so, ultimately, it is (correctly) the layout from the host site is being used.

@section ExtraGoodParts{
    // do some stuff
    <div>wakka wakka</div>
}

I have this in my layout for the site in the host app:

@RenderSection("ExtraGoodParts", false)

However, this is not rendering.  When I decompile the view in the DLL, I see that the execute method builds the section "ExtraGoodParts" through code, but it does not seem to render when the view is rendered. Did I miss a step?  Is this not supported?

I am using MVC4, the views are in a DLL built from a new MVC4 project. I use the BoC library to load the assemblies dynamically as we do not take a reference to the DLLs at design/build time (https://github.com/csteeg/BoC/tree/master/Src/Commons.Web.PrecompiledViews/).

Thanks in advance.

Coordinator
May 31, 2012 at 6:28 PM

I tried using a section in my test app (https://github.com/davidebbo/MvcApplicationRazorGeneratorSeparateLibrary), and it seems to work fine. Can you try to isolate the difference between what you're doing and what my app does? Note that in my case, all the views are precompiled.