U4-1681 - V6: Partial View Macro - Not rendering

Created by Warren Buckley (Personal) 09 Feb 2013, 07:50:22 Updated by Shannon Deminick 05 Mar 2013, 14:18:23

Hello All, I have been playing around with V6 of Umbraco and noticed there is an option to create a Partial View Macro. I am not entirely sure how this is different to a Razor Scripting macro?

However I created a simple navigation Partial View Macro like so:

@inherits Umbraco.Web.Macros.PartialViewMacroPage @using umbraco.MacroEngines

@{ //Get Currentpage as a DynamicNode DynamicNode currentPage = Model.CurrentPage;

//Get homepage
var homepage = currentPage.AncestorOrSelf(1);



And in my template view I use @Umbraco.RenderMacro("Navi") to output the macro, however when stepping through the code my breakpoint inside my Navi Partial View Macro never gets hit and I get Error loading MacroEngine script (file: ~/Views/MacroPartials/Navi.cshtml) message instead displayed on the page.

If you need any further details about the problem, let me know.

Cheers, Warren :)


Shannon Deminick 05 Mar 2013, 14:17:50

@Warren, partial view macros will supersede razor macros entirely so you should be using these instead of razor macros if you are running 6.0

The syntax and objects is identical to MVC, it is not the exact same objects as the now legacy razor macros which had some flaws in it.

You'd be able to follow along with the documentation for MVC to use Partial View macros. The reason your view will not compile is because DynamicNode does not exist in MVC and is now legacy object. You should change your code to:

@inherits Umbraco.Web.Macros.PartialViewMacroPage

@{ //Get Currentpage as a DynamicPublishedContent //since the rest of this script uses dynamic access //to objects instead of the strongly typed IPublishedContent var currentPage = Model.CurrentPage.AsDynamic();

//Get homepage
var homepage = currentPage.AncestorOrSelf(1);


Priority: Normal

Type: Bug

State: Closed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 6.0.0

Due in version:


Story Points: