Tuesday, July 17, 2012

error from asp.net 3.0 to asp.net 4.0

Error:
The type 'System.Web.Mvc.ModelClientValidationRule' exists in both 'd:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies\System.Web.WebPages.dll' and 'd:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll

Resolution:
Issue resolved as per http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253815

Methods (Copied from http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253815 for reference):



  1. In the root Web.config file, add a new <appSettings> entry with the key webPages:Version and the value 1.0.0.0.
  2. <appSettings>
        <add key="webpages:Version" value="1.0.0.0"/>
        <add key="ClientValidationEnabled" value="true"/>
        <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
    </appSettings>
  3. In Solution Explorer, right-click the project name and then select Unload Project. Then right-click the name again and select Edit ProjectName.csproj.
  4. Locate the following assembly references:
    <Reference Include="System.Web.WebPages"/> <Reference Include="System.Web.Helpers" />
    Replace them with the following:
    <Reference Include="System.Web.WebPages, Version=1.0.0.0,
    Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL "/> <Reference Include="System.Web.Helpers, Version=1.0.0.0,
    Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
  5. Save the changes, close the project (.csproj) file you were editing, and then right-click the project and select Reload.


No comments:

Post a Comment