System.Core in VS2010 Projects

Date Published: 24 August 2010

System.Core in VS2010 Projects

I just ran into an odd issue with a VS2010 project. In my case it was an MVC 2 application I was upgrading from VS2008. One of the built-in controllers (ProfileController) was failing to compile because it could not resolve the Linq extension method symbols Single() and Matches(). These are located in the System.Core assembly. I checked my project references in Solution Explorer, and System.Core was not listed. So I tried Add Reference, and System.Core was listed as included and gave me the option of to Remove it.

SNAGHTML4f275de

After some searching, I found this blog post, aptly named Do NOT remove the reference to System.Core from your VS2010 Project. It pointed out that this file is β€œspecial” and that if you remove it (or it gets lost somehow) you need to re-add it manually to your project using this syntax:



There is also a connect issue describing this bug (which is currently marked as Postponed), Cannot remove System.Core.dll reference from a VS2010 project.

In my case this appears to have been an upgrade issue, as the project worked fine in VS2008 before I ran the upgrade wizard to VS2010, and then in the course of trying to get it to compile for the first time, I ran into this issue. Adding the assembly to the project file by hand (via Notepad) solved the problem in my case.

Steve Smith

About Ardalis

Software Architect

Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.