Could not load file or assembly 'System.Core, Version='

I have an ASP.NET 3.5 solution that was recently upgraded to run on .NET 4.0. Despite that, it seems that most of the projects in the solution are still set to target the .NET 3.5 Framework.

That being said, I can't debug any of these projects now. I get the following error:

Parser Error Message: Could not load file or assembly 'System.Core, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
=== Pre-bind state information ===  
LOG: User = myusername
LOG: DisplayName = System.Core, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35  
LOG: Appbase = file:///C:/Projects/myprojectpath/ 
LOG: Initial PrivatePath = C:\Projects\myprojectpath\bin 
Calling assembly : (Unknown).
LOG: This bind starts in default load context. 
LOG: Using application configuration file: C:\Projects\myprojectpath\web.config   
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config. 
LOG: Post-policy reference: System.Core, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35 
LOG: The same bind was seen before, and was failed with hr = 0x80070002.

I have edited my project file manually, as described here and added the following lines:

<Reference Include="System.Core">

But it did no good. Can someone explain why I'm getting this error message and how to resolve it? Thanks!


In my case, there was a line in the web.config that had to be removed.

<pages enableEventValidation="true">
        <add namespace="System.Linq"/>
        <!--<add tagPrefix="asp" namespace="System.Linq" assembly="System.Core, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>-->

(And actually I was able to safely comment out <add namespace="System.Linq"/> as well.

It happened to me that the controls used such as:

            <add assembly="System.Core, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>


Were instead:

            <add assembly="System.Core, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>


Or vice versa. You might wanna check that out. Or migrate the whole project (the frames or pages) to a .net 4.0 one. And also sometimes when I need to work on diferent frameworks I remove the target framework line.

Need Your Help

Blob object not working properly even though the class is seralized

java serialization object blob

I have class which is seralized and does convert a very large amount of data object to blob to save it to database.In the same class there is decode method to convert blob to the actual object.Foll...

communication between two computers with 2 c++ programs

c++ networking computer-vision serial-port robot

I have one computer that is running a c++ program to control a robot and another computer that is running a computer vision system (also written in c++). I would like for these two programs to be a...