VS2010 上的 Microsoft.VisualStudio.TestTools.UnitTesting 命名空间在哪里?

问题描述:

我将包含一些单元测试项目的 VS2008 解决方案转换为 VS2010.转换后,我尝试编译解决方案,但出现以下错误:

I converted a VS2008 solution that contains some unit testing projects to VS2010. After the conversion I tried to compile the solution, but I'm getting the following error:

命名空间Microsoft"中不存在类型或命名空间名称VisualStudio"(您是否缺少程序集引用?)

The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

无法找到命名空间声明using Microsoft.VisualStudio.TestTools.UnitTesting;.此外,我在尝试添加新项目引用时找不到 Microsoft.VisualStudio.QualityTools.UnitTestFramework 程序集.

The namespace declaration cannot be found using Microsoft.VisualStudio.TestTools.UnitTesting;. In addition, I couldn't find the Microsoft.VisualStudio.QualityTools.UnitTestFramework assembly when I tried to add a new project reference.

有人知道我做错了什么吗?

Does anyone know what I'm doing wrong?

我刚刚也遇到了这个问题,还有一个 Microsoft.Data.Schema 库.答案是正确的,因为这些库在机器上并且在 VS 10.0 目录中.

I just had this problem as well, and with a Microsoft.Data.Schema library as well. The answer is correct, in that these library are on the machine and in the VS 10.0 directory.

问题(至少对我而言)是解决方案是从 VS2008 转换而来的,并且转换实用程序针对 .NET 3.5 的项目.由于 10.0 库需要 .NET 4.0,因此编译器不会选择它们.

The problem (at least for me) was that the solution was converted from VS2008 and the conversion utility targetted the project for .NET 3.5. Since the 10.0 library require .NET 4.0 they are not picked up by the compiler.

解决方案是在正确解析的情况下恢复使用 VS2008;或者将项目切换为针对 .NET 4.0 进行编译,以便您可以使用可用的库.

The solution is to either revert to use VS2008 where these resolve correctly; or to switch the project to compile for .NET 4.0 so you can use the available libraries.