“TeamFoundation”类型或命名空间在“Microsoft”命名空间中不存在。

14

我在我的ASP.NET MVC 4应用程序中使用.net 4.0添加了以下引用。

我还将该命名空间包含在我的应用程序中,但是仍然看到以下错误:

 Reference : Microsoft.TeamFoundation.Client.dll
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.Client.dll

   "The type or namespace name 'TeamFoundation' does not exist in the namespace 'Microsoft' "

我有另一个控制台应用程序,在使用该应用程序中引用时没有看到这个错误。对于 Web/MVC 应用程序,我需要做些不同的事情吗?请告诉我。

我还看到了这个警告:

Warning 1   The primary reference "Microsoft.TeamFoundation.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0". 

Amir Popovich是正确的。但我不明白,为什么你需要引用Microsoft.TeamFoundation.Client.dll?它与MVC4毫无关系! - AFract
哈哈..我正在使用TFS API并开发Web应用程序。我需要那个程序集来完成这个目的。 - CodeNinja
1个回答

20

您正在尝试在一个.net 4.0版本的项目中引用一个更高版本.net 4.5)的dll。

请升级您的项目到.net 4.5,或者引用.net 4.0版本的dll。


1
是的,那很合理。我们不能在 .Net 4.0 中使用 Microsoft.TeamFoundation.Build.Client" 版本:12.0.0.0,运行时版本:v4.0.xxxx。请参见链接。问题在于运行时版本没有明确指出这一点。 - Kagan Agun

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接