Migrating my MVC 3 application to MVC 4 - asp.net-mvc-3

I really do not know what to do, I'm following this article that shows how to migrate my MVC 3 application manually .
I followed all the steps but when running my application the following error occurs:
Server Error in '/' Application.
Could not load file or assembly 'System.Web.WebPages.Razor,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT:
0x80131040)
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.IO.FileLoadException: Could not load file or
assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to
determine why the assembly 'System.Web.WebPages.Razor,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
could not be loaded.
WRN: Assembly binding logging is turned OFF. To enable assembly bind
failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There
is some performance penalty associated with assembly bind failure
logging. To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[FileLoadException: Could not load file or assembly
'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)]
Microsoft.Web.Samples.PreApplicationStartCode.Start() +0
[InvalidOperationException: The pre-application start initialization
method Start on type Microsoft.Web.Samples.PreApplicationStartCode
threw an exception with the following error message: Could not load
file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040).]
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1
methods) +423
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +306
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager
appManager, IApplicationHost appHost, IConfigMapPathFactory
configMapPathFactory, HostingEnvironmentParameters hostingParameters,
PolicyLevel policyLevel, Exception appDomainCreationException) +677
[HttpException (0x80004005): The pre-application start initialization
method Start on type Microsoft.Web.Samples.PreApplicationStartCode
threw an exception with the following error message: Could not load
file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040).]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9079340
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +256
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.237
I looked through the code, but I see no reference to System.Web.WebPages.Razor in version 1.0 version 2.0 only.

Use NuGet and add the package Microsoft.AspNet.Mvc (Microsoft Asp.Net Mvc 4). This should upgrade your references. See:
https://nuget.org/packages/Microsoft.AspNet.Mvc
You will need to upgrade the assembly references in your web.config.
Remove from the root web.config:
<assemblies>
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
Add to the root web.config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Views/Web.Config:
Change Razor from 1.0.0.0 to 2.0.0.0:
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<controls>
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>

Did you forget to update the references in Views\Web.Config? The references in it is used to build the view pages.

I assumed you have MVC3 Intranet web application, when upgrade from MVC3 to MVC4 using NuGet, your application now references System.Web.WebPages.Razor Version 2.0.0.0, NOT System.Web.WebPages.Razor Version 1.0.0.0 anymore. Here is my way of resolving the reference.
There are two places to fix:
In the root web.config,
<compilation debug="true" targetFramework="4.0">
<assemblies>
. . .
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
. . .
</assemblies>
</compilation>
change Version=1.0.0.0 to Version=2.0.0.0
So your new reference will look like this:
<compilation debug="true" targetFramework="4.0">
<assemblies>
. . .
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
. . .
</assemblies>
</compilation>
In the Views folder, there is web.config file. Inspecting this file you will see it references Version 1. Replace the whole web.config file in Views folder with a new web.config file. Make a backup of the old web.config file, just in case. To get a brand new web.config for the Views folder, you create a new MVC4 application for intranet. Go to the Views folder. Copy the Web.Config file from the Views folder of the new application to the Views folder of the broken application.
Hope it helps!

Reinstalling the AspNetSprite packages as suggested above does not solve the problem for me. But adding theses lines on the runtime\assemblyBinding section of the root web.config file works :
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>

Have you globally searched for System.Web.WebPages.Razor, Version=1.0.0.0 in your entire solution? Do you still reference System.Web.WebPages.Razor (Version 1.0.0.0)? Do you reference System.Web.WebPages.Razor Version 2.0.0.0?
[Update] I finally ran into the same issue. It seems like one of the NuGet packages I installed and uninstalled didn't entirely remove the reference to System.Web.Razor it used. Cleaning the solution didn't help because the DLL wasn't used directly by the web application. I finally got it to work by manually deleting the entire bin directory ...

Check the web.config inside your views folder.
UPDATE:
This bit looks suspcious.
Microsoft.Web.Samples.PreApplicationStartCode
Are you referencing any sample application libraries, like MVC futures or anything like that?

My application used a third-party package, the AspNetSprites-MvcAndRazorHelper. Reinstalled this package and the error of the reference was corrected.

This is another Nuget package that u can use to upgrade mvc 3 to mvc 4
https://nuget.org/packages/UpgradeMvc3ToMvc4

this is very simple, when you update to MVC 4.0.0.0 ,but the webconfig in the solution still points to MVC 3.0.0.0.0.
so just replace MVC version 3.0.0.0.0. by 4.0.0.0.0
Do the same with other assemblies, to check the version of assembly , check properties of the respective assembly in references in your project.

Related

How to resolve assembly conflict in Visual Studio 2013 web app project?

I have inherited a web app which reports the following assembly conflict when I try to build it under Visual Studio 2013;
There was a conflict between "System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
"System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.
References which depend on "System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies\System.Web.Mvc.dll].
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies\System.Web.Mvc.dll
Project file item includes which caused reference "C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies\System.Web.Mvc.dll".
System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
References which depend on "System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [].
C:\Users\Administrator\Source\Repos\eRTQ\Software\web\ThirdPartyDll\MIM.Framework.Unity.dll
Project file item includes which caused reference "C:\Users\Administrator\Source\Repos\eRTQ\Software\web\ThirdPartyDll\MIM.Framework.Unity.dll".
MIM.Framework.Unity, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL
MIM.Core.ServiceHosts, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL
C:\Users\Administrator\Source\Repos\eRTQ\Software\web\ThirdPartyDll\Microsoft.Web.Mvc.FixedDisplayModes.dll
Project file item includes which caused reference "C:\Users\Administrator\Source\Repos\eRTQ\Software\web\ThirdPartyDll\Microsoft.Web.Mvc.FixedDisplayModes.dll".
Microsoft.Web.Mvc.FixedDisplayModes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL
The Web.config contains this with respect to that assembly;
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
and
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.1"/>
</dependentAssembly>
I've tried removing and re-adding the assembly reference. That doesn't seem to change anything.
I can change the version in Web.config from '4.0.0.1' to '4.0.0.0', and that eliminates the warning, but is it the right thing to do?
Ideas?

how to resolve runtime error in mvc3 razor view (Assembly 'MvcApplication2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null')

I want to create a mvc3 web razor application in visual studio 2010 professional. I added mvc3 web project with razor view but when i compile it it gives error of MVC.WEB.dll older version. then i updated mvc.web.dll to version 4 and web.mvc.webpages to version 2 in my refference assemblieis.
I already added the web.config file configurations when it gives compile time error as show below
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
</assemblies>
</compilation>
but now it not give the compile time error as shown below.
Assembly 'MvcApplication2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Please help me to resolve this matter.
I want to create a mvc3 web razor application
and then
i updated mvc.web.dll to version 4
what?
Exception ... which has a higher version than referenced assembly ...
Try to remove reference from project references (left click on System.Web.Mvc and press delete), then References -> Add reference sort by name on first tab and select System.Web.Mvc with 4.0.0.0 in second column (version).
Under the References you will find the System.Web.Mvc referenced
remove this reference and add a new reference of higher version i.e 4.x

Error replacing System.Web.WebPages dll with my version

I had to make some changes to the ASP.NET MVC System.Web.Webpages dll. But when I replace the dll it throws me this error.
The type 'System.Web.WebPages.WebPageBase' is defined in an assembly
that is not referenced. You must add a reference to assembly
'System.Web.WebPages, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.
I had the same problem,
I eventually solved it by following the advice here.
And adding the following to my web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- … -->
<system.web>
<!-- … -->
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
</assemblies>
</compilation>
<!-- … -->
</system.web>
<!-- … -->
</configuration>
I found that the "copy Local" to true for the referenced "System.Web.Webpages" DLL helped in my case. I also had to do the same to some of the other DLLs as well.
I got this error too when I was moving around directories within TFS. I fixed this error by opening NuGet and updating the MVC framework that was refererenced in all the DLLs.

Installed MVC 4 Beta, now my MVC 3 projects throw an error when I rebuild all

I just installed MVC 4 Beta, and now my MVC 3 projects (that I haven't converted yet to 4) are throwing an error when I rebuild all:
Error 18 [A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'. Type B originates from 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'.
Has anyone come across this yet? Thanks!
I've spent the entire day trying to fix this, and after an afternoon systematically ripping EVERYTHING out of my project except one basic view and one basic controller it was still throwing this error. So I started deleting other stuff and found there was a rogue Web.Config file in my Views folder that had MVC 3 stuff in it.
Search your project for other Web.Config files!!!
I had the same issue, and was able to solve it as follows:
Remove the assembly System.Web.WebPages.Razor from the project references.
Press Save All on the solution
Add the assembly again, make sure you select version 1.0.0.0. Select True for Specific Version in the reference properties.
I got an solution for this:
You need to add this to your mvc 3 web.config:
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.WebPages" />
<!-- Your namespace here -->
</namespaces>
</pages>
</system.web.webPages.razor>
And also copy the binfiles from
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies
to your project binfolder
If you need deploy your mvc 4 project on a server that you dont have installed mvc 4 on you need to the same but change version from 1.0.0.0 to 2.0.0.0 in the section part.
Good luck!
The steps to fix this issue
First find all web.config files in whole project
In all web.config file, find the given 'cannot be cast' error code and change version 2.0.0.0 in configSections of all web.config files
System.Web.WebPages.Razor.Configuration.HostSection
again if the error comes then find that error code and change the version 2.0.0.0 in all web.config files. repeat the process until fix the version related issues.
When you install MVC4, your mvc3 projects will point to system.web.webpages ver 2.0..
For you MVC3 projects, Remove the reference to system.web.webpages ver 2.0.. and add a reference back to system.web.webpages ver 1.0..
Recompile and redeploy and it should work again...
Not sure why it does that, but it's still a beta install
Just in case someone else runs into this same problem. It looks like there are a few different things that can cause this particular error. This is the best description of what is causing the error that I've found. In my specific case, I added a reference to a library via NuGet, and it looks as if a specific reference to System.Web.WebPages was added to my project. I removed this reference, rebuilt, and everything was good to go.
Good luck to others with similar problems!
Make sure that the references to System.Web.WebPages is 2.0.0.0 in root/Web.config and root/Views/Web.config
If every thing is pointing to version 2 then verify if you have the directory "_bin_deployableAssemblies".
If you have it, then right click on your project and choose the option "Add Deployable Dependencies..." then check MVC and Razor options to update your DLLs.
Might help someone:
Added correct version of DLL conlfic between razor 1.0 and 2.0
Modified the web.config file where it says 3.0 to 4.0 and 1.0 to 2.0 only for MVC and razor
Another web.config hidden under view that also need to be modified.
Above three steps helped to resolve the issue.
The problem it's that you may have another web.config in the Views directory that have recerences pointing to the old asemblies. When the project loads, It tries to load both versions and then fails.
Try to also correct the versions on the "View's" web.config.
For the oncoming, like me.
That looks like you may have to update some of the assembly data in your web.config.
It looks Like We need to change the version number, if we upgrade to mvc4 from mvc3.
I just changed the webconfig, which is in Views Folder.... Need to change the version number
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web.webPages.razor>
<pages
validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=**4**.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=**4**.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=**4**.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<controls>
<add assembly="System.Web.Mvc, Version=**4**.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
</system.web>

Upgrade MVC2 to MVC3 - Problem only on Server [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
I have upgrade my MVC2 project to MVC3 using this tool: http://blogs.msdn.com/b/marcinon/archive/2011/01/13/mvc-3-project-upgrade-tool.aspx
Which is working fine and my Project is also runnig fine on my local pc, but when i deploy it to the server, which is also has MVC3 installed, it just return this error:
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\a8d37933\32de45bd\assembly\dl3\b1e279bf\0dc3e090_ffd7cb01\BaseUtility.DLL: error CS1705: Assembly 'BaseUtility, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
c:\Windows\assembly\GAC_MSIL\System.Web.Mvc\2.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll: (Location of symbol related to previous error)
And my webconfig also contain this part:
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Anyone have a idea how do i fix this problem,
Thanks in advance
Jack
Thanks Hambonious, This solved my problem:
I have checked my webconfig file and found out that a part of it is still using MVC2 in the .

Resources