I have an issue with upgrading a demo application I've downloaded from codeproject to the MVC5 framework.

Now, the code itself works beautifully after building/running, however what is happening is I can see in "Index.cshtml" in the Home Views is the old error where it's looking at the wrong assembly (System.Web.Webpages instead of System.Web.MVC). I worked on this for a very long time and eventually fixed the issue in the ChildNode view (ChildNode.cshtml). The fix ultimately was to move the config sections listed below in the Views folder into the main web.config (after I'd upgraded the project from VS2010 to V2013, used NuGet Package Manager to upgrade the MVC frameworks and then adjusted the main web.config to use the assembly versions I wanted).

    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />

    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />

What has me stumped is the Index.cshtml is reporting it can't find the ViewBag, @model or Html.Partial action, but the ChildNode.cshtml (in the same project, in the same view area) can.... This looks like a hack to me, can anyone else try downloading and upgrading the project to confirm?

Child View - Actually works

Thanks in Advance!

Related posts

Recent Viewed