I am currently working on another issue in my ASP.NET MVC project. In an effort to better understand what is happening in the codebase I decided to reference the ASP.NET MVC Source Code project in my own project by adding the solution file to my references.
When I did this, I started getting HTTP 404 errors.
It just so happens I had a breakpoint set on the OnException()
method of the HandleErrorAttribute
, otherwise it might have taken a long time to find the actual problem. When I hover over the filterContext
parameter in the OnException
method call, I get this Exception
description:
The type 'System.Web.Mvc.ViewMasterPage' is ambiguous: it could come from assembly [path to assembly in GAC] or from assembly [path to assembly in my project]
The assembly in the GAC is there because I installed the ASP.NET MVC 2.0 RC2 release.
How do I best resolve this ambiguity?
System.Web.Mvc
is referenced inWeb.Config
, in the<Compilation><Assemblies>
section. In my application, this entry has a public key token attribute.I solved the problem by removing the
PublicKeyToken
attribute.So this:
becomes this:
Apparently Visual Studio can't find the signed assembly in the GAC when the
PublicKeyToken
is missing, so it is forced to use the local project assembly.I am not sure but maybe your answer lies in the assemblyBinding tag of your config: http://msdn.microsoft.com/en-us/library/twy1dw1e.aspx