Assembly System.Web.Mvc 3.0.0.1 which has a higher version than referenced assembly 3.0.0.0
Back to learning
Created: 05/04/2018
Error:
Event code: 3007
Event message: A compilation error has occurred.
Application information:
Application domain: /LM/W3SVC/1/ROOT/MyProj-7-131674308158875895
Trust level: Full
Application Virtual Path: /MyProj
Application Path: E:\Program Files\MyProj\
Machine name: MyServer
Process information:
Process ID: 6020
Process name: w3wp.exe
Account name: TEST
Exception information:
Exception type: HttpCompileException
Exception message: (0): error CS1705: Assembly "XXXXXXX, Version=2011.6.3.1141, Culture=neutral, PublicKeyToken=null" uses "System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which has a higher version than referenced assembly "System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
at System.Web.Compilation.AssemblyBuilder.Compile()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp)
at System.Web.Compilation.BuildManager.CompileGlobalAsax()
at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
at System.Web.Compilation.BuildManager.CallAppInitializeMethod()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
Solution:
In your pc you have the following folder: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies
Inside you have System.Web.Mvc.dll in this case this file was version 3.0.0.1
So when you compile in your Vs2017 your project, it references to this folder and to that particular file.
So just find older version of System.Web.Mvc.dll (3.0.0.0) somewhere and put it in that directory, and finally recompile your project. Now it will references to the proper version.
It wont say in Properties of that file 3.0.0.0, it will be somthing like:
Product version: 3.0.20105.0
Before:
Product version: 3.0.50813.1
In my case to obtain older version i took directly from the project BIN filder from production environment.