Wednesday, January 27, 2010

TFS 2010 Console Application and the .Net 4.0 Client Profile

One little frustration that has caught me twice now (and so it’s time to blog it so I remember it), is that when you create a Console Application and then start adding references to any of the TFS API libraries to it (such as Microsoft.TeamFoundation.Client.dll), if yoiu just accept all the defaults for a Console Application in Visual Studio 2010 Beta 2, you get this warning

Warning    1    The referenced assembly "Microsoft.TeamFoundation.Client, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" could not be resolved because it has a dependency on "System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client".    BasicEventListener


and the application will not compile.

The issue is the .Net 4.0 Client Profile does not contain the reference to System.Web, which is required by the TFS API. This is simple to fix, just go to the Properties of your project, and for the Target Framework, select “.Net Framework 4” instead of the “.Net Framework 4 Client Profile”.

No comments:

Post a Comment