If you suddenly find your Visual Studio solution falling to pieces with loads of error messages like the title above when you build. You also know that the project libraries are being referenced correctly and they build OK. Then check that you do not have an uninvited app.config file lurking at the root of any of your projects.
I have spent lots of annoying wasted hours trying to figure this out only to have found that a NuGet installation has added an app.config to the projects.
Delete this and do a rebuild and all should be OK.
The moral of this story is make sure you build and check-in before adding any NuGet packages. Then immediately rebuild after. If this scenario occurs, you know what to do.
I have just come across one of the best Visual Studio extensions called NuGet (http://nuget.org/).
The easiest way to get going is to add it to Visual Studio using the ‘Extension Manager’ which you will find under the ‘Tools’ menu. It’s called ‘NuGet Package Manager’.
Once installed, it is simplicity itself to add a reference and download the binaries, dependencies and code for a useful library (such as MVVM Light or jQuery).
Right-click on the references folder in your solution.
Select ‘Manage NuGet Packages…’
and voila…search for new libraries or check for updates. If NuGet finds any updates then you will get an alert when VS2010 starts.
Potential TFS connection Problem TF30063
There is one fly in this ointment that took me a little time to resolve. A bug in NuGet can force the connection to your TFS server to be dropped. The only way out is to restart Visual Studio. the solution to this turns out to be extremely trivial.
All you need to do is add your TFS server URL to the Intranet security group in Internet Explorer!