Wednesday, August 25, 2010

Do NOT remove the reference to System.Core from your VS2010 Project

One of the things I routinely do when adding a new class library project, is remove all references and just add them back in as I need them. That is NOT a good idea for Visual Studio 2010. When I DID need System.Core, and went to add it back, this is what I got:
"A reference to 'System.Core' could not be added. This component is automatically referenced..."
After some Googling I found this article:
http://connect.microsoft.com/VisualStudio/feedback/details/525663/cannot-remove-system-core-dll-reference-from-a-vs2010-project
It tells you to add it back manually. Here is the part that needs back in the project file. After the last PropertyGroup node, add this node:
 <ItemGroup>
   <Reference Include="System.Core" />
 </ItemGroup>
You should be good to go again.
Read more: Lee Brandt's Blog