installed Microsoft.VisualStudio.QualityTools.UnitTestFramework 没有出现在 nuget 包列表中

installed Microsoft.VisualStudio.QualityTools.UnitTestFramework does not appear in nuget package list

我正在与 VS2013.NET4.5

合作

我希望在我的测试中使用 Microsoft.VisualStudio.TestTools.UnitTesting.TestCategoryAttribute 以在构建服务器中禁用它们。我无法在 Add reference -> Assemblies 中找到它,所以我想 to use nuget package。最初我是通过 'Package Manager Console' 安装的。

现在我遇到 Microsoft.VisualStudio.QualityTools.UnitTestFramework nuget 包的奇怪问题。当我在项目级别通过 Manage nuget packages 安装它时,我在参考中看不到它。如果我尝试再次安装它,它会显示安装按钮,但是当我点击它时没有任何反应。

如果在找到包时在解决方案级别进行搜索,它会显示绿色 'installed' 复选框,但我无法在已安装的包中找到它,因此无法为项目启用它。

我已经检查了 packages 文件夹和文件。

我可以通过浏览到 packages 文件夹中的 .dll 来手动添加引用,但这看起来像是一个 hack,我很确定它会在构建服务器上失败。

并且只能手动删除它,方法是转到 \packages 删除 .nupkg,然后从 packages.config 中删除引用。

您是否经历过类似的事情(可能是其他 nuget 包之一)?原因是什么?你是怎么解决的?

我们也遇到过这个问题,如果您查看包管理器输出:

Could not install package 'Microsoft.VisualStudio.QualityTools.UnitTestFramework 11.0.50727.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

这与不同的 .NET 框架有关,此程序包仅支持 4.5.2。

我最近也遇到了这个问题,安装 Microsoft.VisualStudio.UnitTesting 反而解决了这个问题。确保通过首先删除 VisualStudio.QualityTools.UnitTestFramework 引用并通过 nuget 包管理器将 Microsoft.VisualStudio.UnitTesting 安装到单元测试项目来引用包文件夹中的库。