This problem has been cropping up a lot recently - projects will complain of missing namespace's when I open them up and attempt to compile the first time. If this has happened to you then read on for a simple fix.
I don't know if this one is a bug in Visual Studio 2010 (Beta 2 and RC1) or something else but recently I have noticed this error cropping up more and more. When I open an existing project it might fail to compile. I have also noticed it happen when I have downloaded a fresh project. Its not something I have pinned down but whenever I see this error:
Error 1 The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
I know that the solution is quick and simple.
To get your compiler back on its feet you simply need to add a reference to System.Core.
- Right click on the Bin folder in the Solution Explorer
- Choose Add Reference…
- Click the .NET tab and scroll down to System.Core
- If you wait a few moments for the entire list to load you can simply click once on the list and start type System.Core. This will select the right item without you having to scroll and search for it.
- Click OK to accept the new reference
Once you have completed this cycle once you will be able to quickly select it by complete Step 1, 2 and then clicking the Recent tab and quickly selecting it from the short list.