Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-10-21
5
Medium Priority
?
3,572 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 2000 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

Docker-Compose to Simplify Multi-Container Builds

Our veteran DevOps Author takes you through how to build a multi-container environment, managed with a single utility in order to simplify your deployments.

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 shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

722 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