Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Paul Stoker 39 posts 72 karma points c-trib
    Mar 22, 2012 @ 16:10
    Paul Stoker

    Umbraco 5 razor helper causing problems

    Hi Umbrocans,

    Yesterday I downloaded Umbraco 5 and ran it via Web Matrix on my Windows XP.

    Today I tried to create a sitemap with razor but everytime I create a helper method I get the CS0433 error message. Has anyone else had this problem? I changed the helper name to something random to no avail and I've even tried removing either of the files which didn't work either?


    Compiler Error Message: CS0433: The type 'System.Web.WebPages.HelperResult' exists in both 'c:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\System.Web.WebPages\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.dll' and 'c:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\System.Web.WebPages\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.dll'

    Source Error:

    Line 55: 
    Line 56: #line hidden
    Line 57: public System.Web.WebPages.HelperResult traverse(dynamic node, int pad) {
    Line 58: return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
    Line 59: 

    Source File: c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\45baf68f\2ba1f2f8\App_Web_contentpage.cshtml.a270542a.q7_qc8vc.0.cs    Line: 57


  • Paul Stoker 39 posts 72 karma points c-trib
    Mar 23, 2012 @ 10:28
    Paul Stoker

    Hmmm still didn't get anywhere with this error but then I downloaded Umbraco 5.0.1 and don't have a problem any more. I guess more of the creases have been ironed out ;-)

  • Andrew Sayre 25 posts 46 karma points
    Apr 09, 2012 @ 05:52
    Andrew Sayre

    Hi Paul,

    I have been running into this problem as well.  It's not actually about the helper delegates in Razor views, rather, a conflicting build provider registration for Razor.  When the MVC 4 / WebPages 2 beta is installed, a new build provider for WebPages 2 is added to the machine.config.  In this instance, Umbraco 5 web app references version 1.0 of the assembly, but the 'newer' build provider is winning out during compilation.  Thus the invalid cast exceptions...

    To cut to the chase, the solution is to simply add the following to the web.config application settings: <add key="webpages:Version" value=""/>

    Hope this helps others that run into the problem!


Please Sign in or register to post replies

Write your reply to: