Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Upgrade to MVC 5.0 causes @Html.Partial razor to no longer render on the server (locally runs fine)

$
0
0

I've recently upgraded my MVC 4 application to MVC 5.  When debugging locally (IIS Express or full), the application runs as before.  When deploying, via Visual Studio, to our development box, I get the following error from IIS:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS1928: 'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'Partial' and the best extension method overload 'System.Web.Mvc.Html.PartialExtensions.Partial(System.Web.Mvc.HtmlHelper, string)' has some invalid arguments

Source Error:


Line 25: <body>
Line 26:     <div id="applicationHost">
Line 27:         @Html.Partial("_splash")
Line 28:     </div>
Line 29: 


The detailed compiler output shows the following:

Microsoft (R) Visual C# Compiler version 4.0.30319.17929

for Microsoft (R) .NET Framework 4.5
Copyright (C) Microsoft Corporation. All rights reserved.

d:\websites\mvcapp\Views\ItemCard\index.cshtml(27,10): error CS1928: 'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'Partial' and the best extension method overload 'System.Web.Mvc.Html.PartialExtensions.Partial(System.Web.Mvc.HtmlHelper, string)' has some invalid arguments
d:\websites\mvcapp\Views\ItemCard\index.cshtml(27,10): error CS1929: Instance argument: cannot convert from 'System.Web.WebPages.Html.HtmlHelper' to 'System.Web.Mvc.HtmlHelper'
d:\websites\mvcapp\Views\ItemCard\index.cshtml(32,83): error CS0103: The name 'Url' does not exist in the current context


It looks as if there is perhaps a namespace collision in the compiled temp assembly.  

The code of the .cshtml file in question is as follows:

@using System.Web.Mvc
@using System.Web.Mvc.Html
@using System.Web.Optimization<!DOCTYPE html><html><head><title>MVC App</title><meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="apple-mobile-web-app-status-bar-style" content="black" /><meta name="format-detection" content="telephone=no"/><meta name="viewport" content="width=device-width, initial-scale=1.0" />   
    @Styles.Render("~/Content/css")<script type="text/javascript">
        if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
            var msViewportStyle = document.createElement("style");
            var mq = "@@-ms-viewport{width:auto!important}";
            msViewportStyle.appendChild(document.createTextNode(mq));
            document.getElementsByTagName("head")[0].appendChild(msViewportStyle);
        }</script></head><body><div id="applicationHost">
        @Html.Partial("_splash")</div>

    @Scripts.Render("~/scripts/vendor")
        @if(HttpContext.Current.IsDebuggingEnabled) {<script type="text/javascript" src="~/Scripts/require.js" data-main="@Url.Content("~/App/main")"></script>
        } else {			
            @Scripts.Render("~/Scripts/main-built")
        }</body>

IIS on the server is running a 4.0 apppool, and .NET 4.5 is installed on the box.

Thanks,

Josh


Viewing all articles
Browse latest Browse all 8156

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>