Pages

Tuesday, August 21, 2012

Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0 ...


Today while updating a previously Visual Studio 2010 Website to use Visual Studio 2012 I got an error building the website in VS2012. The website calls some web services and error occurred any way I tried to build the site.

Reference.svcmap: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. App_WebReferences/WebServiceName/

This seemed odd because I hadn't used System.Web.Mvc in that project and it wasn't used as namespace or an added assembly. After looking around I did find several posts talking about similar issues and my best guess is that one of the used DLL's actually require it.

Solution

While I don't know the exact cause the solution was simple enough. Add the following to the web.conf file.



  .....
  
    
      
        
          
          
        
      
    
   
 ........


After which I finally found an answer on stackoverflow with the same solution.

When you add  Service References and  use the advance settings and but chose to not reuse types in referenced assembles. If you already added the Service Reference edit by clicking Configure Service Reference on the svcmap.

Add Service Advance Settings - Do not Reuse Types

I currently don't know why either of these fix it and don't have the time today to dig in and figure out why.

Goodluck.

3 comments:

  1. Thank you! This was very helpful!

    Gorkem.

    ReplyDelete
  2. Hi I am getting this error when I am trying to open my vb.net form designer

    Could not load file or assembly 'Microsoft.Dynamics.Framework.UI.WinForms.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

    Any Ideas

    ReplyDelete
  3. The website in VS2012. The website calls some web services and error occurred any way I tried to build the site.web design tutorials

    ReplyDelete

Please leave a comment; someone, anyone!