Running c++ unittest using vstest.console.exe without visual studio installed
unit-testing, visual-studio-2013
Solution
The `FileNotFoundException` was due to some required assemblies missing. I discovered these using WinDbg and copied them over to the TestWindow folder.
- Microsoft.VisualStudio.Diagnostics.Measurement.dll
- Microsoft.VisualStudio.Diagnostics.ServiceModelSink.dll
- Microsoft.VisualStudio.QualityTools.Common.dll
- Microsoft.VisualStudio.QualityTools.ExecutionCommon.dll
- Microsoft.VisualStudio.QualityTools.Resource.dll
- Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
These assemblies can be found at `C:\windows\assembly\GAC_MSIL` on the machine that has visual studio installed.
I also noted that if I removed the `/tests` switch from the `vstest.console` command, these extra dlls were not required.
Also copied the following dlls to the TestWindow folder (to account for cases where the target machine doesn't have visual c++ runtime)
- C:\Windows\System32\msvcr120.dll
- C:\Windows\System32\msvcp120.dll
Problem
I copied the TestWindow folder (C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow) to a machine that doesn't have visual studio installed and tried running the vstest.console.exe command on an x64 cpp test dll. ``` vstest.console.exe tests.dll /tests:testmethod1 /platform:x64 /logger:console ``` This is the error I see in the event log. ``` Application: vstest.discoveryengine.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException Stack: at Microsoft.VisualStudio.TestPlatform.TestRunnerService.DataCollectors.DataCollectionPluginManager..ctor() at Microsoft.VisualStudio.TestPlatform.TestRunnerService.WcfTestRunnerService..ctor(System.Threading.ManualResetEvent) at Microsoft.VisualStudio.TestPlatform.TestRunnerService.TestRunnerServiceHost.CreateServiceHost(System.String, System.Threading.ManualResetEvent) at Microsoft.VisualStudio.TestPlatform.TestRunnerService.ServiceMain.Main(System.String[]) ```