开发者

ASP.NET MVC 2 System.Web.Mvc.dll conflict

I have installed the ASP.NET MVC 2 RC and opened the default "example project", but get the following error:

Parser Error Message: The type 'System.Web.Mvc.ViewMasterPage' is ambiguous: it could come from assembly 'C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mvc\2.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll' or from assembly 'C:\Documents and Settings\sfent\My Documents\Visual Studio 2008\Projects\MvcApplication1\MvcApplication1\bin\System.Web.Mvc.DLL'. Please specify the assembly explicitly in the type name.

This appears to be a conflict between the GAC dll and the dll created and placed in the bin directory (which I thought was supposed to be used in preference to the GAC version)

I have Googled this issue and have found similar problems, but relating to incorrect namespacing. This is the un-altered example application that comes bundled with the MVC framework.

I have also tri开发者_C百科ed removing the framework entirely and re-installing the RC, but to no avail.

All suggestions appreciated.


I got this error, and in my case it was resolved quite easily.

I had made a new Master Page in my Views folder, but unnoticed by me, it came with code behind and designer, which of course you don't want with MVC2. It all built, but gave me that "Parser Error Message: The type 'System.Web.Mvc.ViewMasterPage' is ambiguous:..." error when I ran it.

To fix it, I removed the code-behind and designer files for my new Master page, and the error went away.


the problem might be that the Reference in your Project is still pointing to the old Version of the dll (v1.0). Delete the reference and add a new one to version (v2.0).

You find that hint as well in the release notes of MVC2 RC:

"Open the project using Visual Studio, and in Solution Explorer, expand the References node. Delete the reference to System.Web.Mvc (which points to the version 1.0 assembly). Add a reference to System.Web.Mvc (v2.0.0.0)."

Cheers, Damrod


Does your project reference both v1 and v2 of the framework? Also, why not delete the matching dll that's been copied locally?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜