Solved

Visual Studio 2012/2013 GAC System.Web.MVC.dll Versions?

Posted on 2014-10-21
5
3,498 Views
Last Modified: 2014-10-21
I recently installed VS 2013 on a dev computer which uses VS 2010/2012 versions. After successfully building and deploying a new VS 2013 project, I needed to update a prior VS 2012 project. It would not build, needs System.Web.MVC.dll  (v. 4.0.20710.0).

[Problem:]
The VS2013 replaced System.Web.MVC.dll  (v. 4.0.20710.0) with  (v. 4.0.40804.0).

[Attempted Solution:]
I took a VS2012 project backup and copied System.Web.MVC.dll  (v. 4.0.20710.0) into the web bin folder and referenced it and set Copy Local to true .

So now the VS2012 project builds and debugs great, just like it used to before installing VS2013.

[New Problem:]  
Now, when I publish the older file is overwritten with the newer System.Web.MVC.dll, which I don't want to use.

Q. Should I add the prior System.Web.MVC.dll (v. 4.0.20710.0) to the GAC?
Q. If so, how do I safely add it and keep both version?

I have never needed to change anything in the GAC before...
0
Comment
Question by:WorknHardr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 27

Accepted Solution

by:
Sammy Ageil earned 500 total points
ID: 40394520
You shouldn't need to use the GAC.
You should be able to use  assembly binding for whatever version you want to use
Note that you also need System.Web.Abstractions,System.Web.Routing and System.Web.WebPages
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!-- … -->
  <system.web>
    <!-- … -->
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Mvc, Version=20710.0, Culture=neutral, PublicKeyToken=ADD_PUBLIC_TOKEN_KEY_HERE, 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>

Open in new window


Make sure to change the versions and public token keys in the config to match your assemblies versions and keys
you can identify the public token key by either using reflector or SN.exe http://msdn.microsoft.com/en-us/library/k5b5tt23%28VS.80%29.aspx
if you choose to use SN.EXE, this command will give you the public token key for the assembly "sn -T AssemblyName.dll"

Good luck
0
 

Author Comment

by:WorknHardr
ID: 40394552
I don't know exactly what changed in VS2012 projects after installing VS2013. I see other dev's on the Internet having similar difficulties too. I get this error on our Server 2012 IIS web host after publishing a VS2012 project:

     Could not load file or assembly 'System.Web.Mvc, Version=4.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)
0
 

Author Comment

by:WorknHardr
ID: 40394566
I noticed the System.Web.Mvc file version is now 4.0.0.1 instead of 4.0.0.0 as before. So I just changed the web.config to this and the web site error is gone:

    <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.1" />
      </dependentAssembly>
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 40394594
Glad you got it working
0
 

Author Closing Comment

by:WorknHardr
ID: 40394664
Thx
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question