Hmm, your first notation works just fine for me, so just as a test I installed a fresh 6.2.0 with the Simple starter kit and put this in a Scripting file (macroScripts\test.cshtml):
@foreach(var item in Model.AncestorOrSelf(1).Descendants("umbTextpage").Where("Visible").Take(1)) {
<h2>@item.Name</h2>
}
And that works as a macro on the template (either masterpages or a view template) and also when inserted as a macro in the rich text editor and even as an inline macro in a masterpage:
something has gone wrong during the upgrade. In log I found lines with this:
[7] WARN umbraco.macro - [Thread 16] Error loading MacroEngine script (file: Aktionen.cshtml, Type: ''. Exception: System.Exception: ContentTypeService failed to find a content type with alias "WidgetTextBox".
In 6.1.6 I had a Document Type with name Widget-TextBox and alias Widget-TextBox. After upgrade the alias has automaticaly change to WidgetTextBox. It thus seems somehow to hang out together. Now, I have tested in a fresh 6.2.0 too and it works.
Razor error after upgrade to 6.2.0
Hi,
after upgrade from 6.1.6 to 6.2.0 any Scripting Files show an "Error loading Macro Engine script" message.
This is one of my simple scripts which are crashed:
It seems that would be the error here in foreach:
.Descendants("Aktion")
It works great in 6.1.6 before.
Has everything changed in Razor in 6.2.0? Any ideas?
Best regards
Sören
It works with this code:
Someone understands why this no longer works with the first code in 6.2.0?
Hmm, your first notation works just fine for me, so just as a test I installed a fresh 6.2.0 with the Simple starter kit and put this in a Scripting file (macroScripts\test.cshtml):
And that works as a macro on the template (either masterpages or a view template) and also when inserted as a macro in the rich text editor and even as an inline macro in a masterpage:
So I'd advise to have a look in the log (App_Data\Logs\UmbracoTraceLog.txt) to see what's really going on.
Hi Sebastiaan,
something has gone wrong during the upgrade. In log I found lines with this:
[7] WARN umbraco.macro - [Thread 16] Error loading MacroEngine script (file: Aktionen.cshtml, Type: ''. Exception: System.Exception: ContentTypeService failed to find a content type with alias "WidgetTextBox".
In 6.1.6 I had a Document Type with name Widget-TextBox and alias Widget-TextBox. After upgrade the alias has automaticaly change to WidgetTextBox. It thus seems somehow to hang out together. Now, I have tested in a fresh 6.2.0 too and it works.
Thank you!
Sören
is working on a reply...