这是我第一次尝试在VS 2017中使用新的 Live Unit Testing 功能。
当我点击Test | Live Unit Testing | Start
时,我会在输出窗口中看到以下内容:
[13:55:37.376 Verbose] - Orchestrator - Request to start Live Unit Testing. (Source = MenuItem)
[13:55:37.376 Verbose] - Orchestrator - Handling request to start LiveUnitTesting.
[13:55:37.633 Verbose] - Orchestrator - Connected to LiveUnitTesting process
[13:55:37.653 Verbose] - BuildManager - Allow to send a single build event.
[13:55:37.653 Info] - Orchestrator - Live Unit Testing started.
[13:55:37.653 Verbose] - TestExplorerServiceClient - Updating client state from Disabled to Enabled
[13:55:37.653 Verbose] - StatusMargin - Received a SystemStatusChangedEvent: Started
[13:55:37.663 Verbose] - BuildManager - Building solution.
[13:55:37.664 Verbose] - BuildManager - Building project ExcelLibrary.Tests.
[13:55:37.666 Verbose] - RemoteOrchestrator - Received SubscriptionEvent for 'C:\VS\ExcelLibrary\ExcelLibrary.Tests\ConMetPartNumberUtilsTests.cs - C:\VS\ExcelLibrary\ExcelLibrary.Tests\ExcelLibrary.Tests.csproj' (Subscribe)
[13:55:37.669 Verbose] - Aggregator - Received subscription request for 'C:\VS\ExcelLibrary\ExcelLibrary.Tests\ConMetPartNumberUtilsTests.cs - C:\VS\ExcelLibrary\ExcelLibrary.Tests\ExcelLibrary.Tests.csproj'
[13:55:37.680 Verbose] - Aggregator - Adding 0 methods from 'C:\VS\ExcelLibrary\ExcelLibrary.Tests\ConMetPartNumberUtilsTests.cs - C:\VS\ExcelLibrary\ExcelLibrary.Tests\ExcelLibrary.Tests.csproj' to the coverage aggregation work list
[13:55:37.685 Verbose] - Aggregator - Starting coverage aggregation cycle - work list has 0 methods
[13:55:37.687 Verbose] - Aggregator - Finished coverage aggregation cycle - work list had 0 methods of which 0 methods were defined in 1 open files
[13:55:38.106 Verbose] - BuildManager - C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4008: A conflicting assembly for the task assembly "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.BuildTasks.dll" has been found at "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.BuildTasks.dll".
[13:55:38.118 Verbose] - BuildManager - C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4061: The "FindRibbons" task could not be instantiated from "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.BuildTasks.dll". Value cannot be null.
Parameter name: key
[13:55:38.118 Verbose] - BuildManager - C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(176,9): error MSB4060: The "FindRibbons" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name.
[13:55:38.136 Info] - BuildManager - Build completed (failed).
[13:55:38.136 Verbose] - BuildManager - Interrupting build queue -> no new assemblies.
[13:55:38.136 Verbose] - BuildManager - Interrupting build queue -> no new assemblies.
因此,似乎罪魁祸首是Microsoft.VisualStudio.Tools.Office.BuildTasks.dll
的冲突集合。然而,目前尚不清楚为什么VS报告此错误,因为指定文件夹中只有一个此类文件(没有 BuildTasks.dll.bak 或类似文件)并且没有其他devenv.exe
实例正在运行,并禁用所有加载项。而且我已经尝试过杀死所有必要的进程并重新启动等等。
有趣的是,在Visual Studio 2017安装程序对话框中,已安装的企业SKU标记为Visual Studio Enterprise 2017 (2)
。也许这个问题与(2)
足够相关。最初我安装了Professional,后来安装了Enterprise,最后卸载了Professional。
有什么想法吗?
答案 0 :(得分:3)
https://stackoverflow.com/a/30777648/1954871
中提到了这个问题您可以尝试在GAC中安装Microsoft.VisualStudio.Tools.Office.BuildTasks.dll:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\gacutil" /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.BuildTasks.dll"