0

This may be a similar question, but since the other is not answered I thought I'd ask here. I have a mvc 4 application works fine on my local but when I deployed to my web host I got the following error

ambiguous reference between 'System.Web.WebPages.Scripts' and 'System.Web.Optimization.Scripts'

on every @Scripts.Render("")

Though @Styles.Render("") is fine.

What's the easiest fix for this, I should not need to append "System.Web.Optimization" in front of every @Scripts.

Thanks!

Edit: I tried commenting out System.Web.WebPages in my web.config, still not working, here is my web.config

<pages>
  <namespaces>
    <add namespace="System.Web.Helpers" />
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Optimization" />
    <add namespace="System.Web.Routing" />
    <!--<add namespace="System.Web.WebPages" />-->
  </namespaces>
</pages>
Ray
  • 12,101
  • 27
  • 95
  • 137
  • What version of .net is installed on the host, compared to your local system. I've seen some issues like this when one has .net 4.5 and the other .net 4. – scott-pascoe Feb 13 '13 at 01:26
  • Thanks scott, I'll check with my host. They have this option for ASP.NET 4.0 (integrated pipeline) and I was told me it's 4.5. – Ray Feb 13 '13 at 01:40
  • My web host confirms that it's 4.5 on their server! Very strange, my app runs fine on my machine, wonder what is different. More strange is that the type "System.Web.WebPages.Scripts" does not even exist! – Ray Feb 13 '13 at 04:38

1 Answers1

1

This problem has been resolved by the web host by doing the following:

Removed MVC 4 reference from GAC (since it is meant to be bin deployed) and also re-installed ASP.NET Web Pages 2.

Basically System.Web.WebPages.Scripts is not in WebPages namespace anymore for webpages2, reinstalling it seems to have helped.

Hope this can help others.

Ray.

Ray
  • 12,101
  • 27
  • 95
  • 137