ModelClientValidationRule conflict
Solution 1
please see the below release notes :
http://www.asp.net/learn/whitepapers/mvc4-release-notes
Installing ASP.NET MVC 4 Developer Preview breaks ASP.NET MVC 3 RTM applications.
ASP.NET MVC 3 applications that were created with the RTM release (not with the ASP.NET MVC 3 Tools Update release) require the following changes in order to work side-by-side with ASP.NET MVC 4 Developer Preview. Building the project without making these updates results in compilation errors.
http://www.asp.net/learn/whitepapers/mvc4-release-notes#_Toc303253815
Solution 2
The accepted answer was "useful" but after installing MVC4 beta today, a few of my MVC 3 projects would not compile. (ModelClientValidationRule conflict) The fix was:
Edit:
ProjectName.csproj
Change
<Reference Include="System.Web.WebPages"/>
To
<Reference Include="System.Web.WebPages, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL "/>
Related videos on Youtube
Comments
-
Tassadaque about 4 years
I have installed vs 2011 developer preview side by side with vs 2010. Now when i run my asp.net mvc 3 project in vs 2010 I am getting the following error in my project where i am using ModelClientValidationRule.
The type System.Web.Mvc.ModelClientValidationRule exists in both c:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll and c:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies\System.Web.WebPages.dll
Is this related to vs 2011 conlict with vs 2010 or something else
-
Jay Borseth about 12 yearsOr, more simply, just remove the reference to System.Web.WebPages.
-
Tom Stickel about 12 yearsI'm not sure that works off hand, I've moved onto to another contract job, so I cannot validate that it will work, if you experienced the problem, and got the results you desire then kudos. thx
-
Tom Stickel almost 12 years@Saulius I wouldn't throw the baby out with the bathwater though. System.Web.WebPages is sometimes needed. Even Scott H. has it as part of his Bin Deploy hanselman.com/blog/…
-
Saulius almost 12 years@Tom Stickel didn't stumble at it till now. Just trying to be minimalistic. If my code breaks I vote up your answer :-)
-
Stefan Steiger over 11 yearsAdding ", Version=1.0.0.0" is sufficient.
-
Tom Stickel over 11 yearsI just ran into this again about a year later! I opened with VS 2010 a project I had downloaded and it gave the error, so I knew I planned on making changes to the application with VS 2012, so I opened with VS 2012 and it still gives the same error
-
Tom Stickel over 11 years@Quandary Yes, I was finally able to validate that just adding Version=1.0.0.0 is sufficient. Thus <Reference Include="System.Web.WebPages, Version=1.0.0.0" /> Thanks
-
Christopher King over 10 yearsIf you happen to be using the TagBuilder class then just removing the reference to System.Web.WebPages is not a solution as this is where this class got 'moved to' for the MVC 3 release -- it was apparently previously included in the MVC assembly.
-
Tom Stickel over 10 yearsYes, I agree with you Christopher