cake: The MSTest tool doesn't pick up the mstest.exe from Visual Studio 2017
What You Are Seeing?
I run the unit tests like this:
MSTest("./src/**/bin/" + configuration + "/*.Tests.dll");
I get the following error when running the build script:
An error occurred when executing task 'Run-Unit-Tests'.
Error: MSTest: Could not locate executable.
What is Expected?
I expect my unit tests to run.
What version of Cake are you using?
0.17
Are you running on a 32 or 64 bit system?
64 bit
What environment are you running on? Windows? Linux? Mac?
Windows 10
Are you running on a CI Server? If so, which one?
No, just building on my local machine.
How Did You Get This To Happen? (Steps to Reproduce)
Run a build with unit tests on a machine with only Visual Studio 2017 (Community Edition).
Output Log
========================================
Run-Unit-Tests
========================================
Executing task: Run-Unit-Tests
An error occurred when executing task 'Run-Unit-Tests'.
Error: Cake.Core.CakeException: MSTest: Could not locate executable.
at Cake.Core.Tooling.Tool`1.RunProcess(TSettings settings, ProcessArgumentBuilder arguments, ProcessSettings processSettings)
at Cake.Core.Tooling.Tool`1.Run(TSettings settings, ProcessArgumentBuilder arguments, ProcessSettings processSettings, Action`1 postAction)
at Cake.Core.Tooling.Tool`1.Run(TSettings settings, ProcessArgumentBuilder arguments)
at Cake.Common.Tools.MSTest.MSTestRunner.Run(IEnumerable`1 assemblyPaths, MSTestSettings settings)
at Cake.Common.Tools.MSTest.MSTestAliases.MSTest(ICakeContext context, IEnumerable`1 assemblyPaths, MSTestSettings settings)
at Cake.Common.Tools.MSTest.MSTestAliases.MSTest(ICakeContext context, IEnumerable`1 assemblyPaths)
at Cake.Common.Tools.MSTest.MSTestAliases.MSTest(ICakeContext context, String pattern)
at Submission#0.<.ctor>b__11()
at Cake.Core.CakeTaskBuilderExtensions.<>c__DisplayClass5_0.<Does>b__0(ICakeContext context)
at Cake.Core.ActionTask.Execute(ICakeContext context)
at Cake.Core.DefaultExecutionStrategy.Execute(CakeTask task, ICakeContext context)
at Cake.Core.CakeEngine.ExecuteTask(ICakeContext context, IExecutionStrategy strategy, Stopwatch stopWatch, CakeTask task, CakeReport report)
at Cake.Core.CakeEngine.RunTarget(ICakeContext context, IExecutionStrategy strategy, String target)
at Cake.Scripting.BuildScriptHost.RunTarget(String target)
at Submission#0..ctor(Session session, Object& submissionResult)
at Submission#0.<Factory>(Session session)
at Roslyn.Scripting.CommonScriptEngine.Execute[T](String code, String path, DiagnosticBag diagnostics, Session session, Boolean isInteractive)
at Roslyn.Scripting.Session.Execute(String code)
at Cake.Scripting.Roslyn.Stable.DefaultRoslynScriptSession.Execute(Script script)
at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
at Cake.Commands.BuildCommand.Execute(CakeOptions options)
at Cake.CakeApplication.Run(CakeOptions options)
at Cake.Program.Main()
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (12 by maintainers)
Commits related to this issue
- Fix #1522 MSTest.exe tool path support for VS2017 — committed to bertvansteen/cake by deleted user 7 years ago
- Fix #1522 MSTest.exe tool path support for VS2017 — committed to bertvansteen/cake by deleted user 7 years ago
- Sets the path to the VSTest executable This is a temporary workaround until cake-build/cake#1522 is solved. — committed to ecampidoglio/Linker by ecampidoglio 7 years ago
- Sets the path to the VSTest executable This is a temporary workaround until cake-build/cake#1522 is solved. — committed to ecampidoglio/Linker by ecampidoglio 7 years ago
- Sets the path to the VSTest executable This is a temporary workaround until cake-build/cake#1522 is solved. — committed to ecampidoglio/Linker by ecampidoglio 7 years ago
- Fix #1522 MSTest.exe tool path support for VS2017 — committed to bertvansteen/cake by deleted user 7 years ago
- Fix #1522 MSTest.exe tool path support for VS2017 — committed to bertvansteen/cake by deleted user 7 years ago
- Merge branch 'bertvansteen-#1522-mstest-for-vs2017' into develop — committed to cake-build/cake by devlead 7 years ago
- Fix #1522 MSTest.exe tool path support for VS2017 — committed to CRuppert/cake by deleted user 7 years ago
- Fix error running unit tests When running tests, the following error occurs: VSTest: Could not locate executable. https://github.com/cake-build/cake/issues/1522#issuecomment-341612194 indicates tha... — committed to dnnsoftware/Dnn.Platform by bdukes 5 years ago
- Fix error running unit tests (#2940) When running tests, the following error occurs: VSTest: Could not locate executable. https://github.com/cake-build/cake/issues/1522#issuecomment-341612194 i... — committed to dnnsoftware/Dnn.Platform by bdukes 5 years ago
- Update development with fixes from v9.4.0-rc (#2941) * Fix error running unit tests (#2940) When running tests, the following error occurs: VSTest: Could not locate executable. https://github... — committed to dnnsoftware/Dnn.Platform by valadas 5 years ago
- Updating development with recent changes on release/9.4.x (#2964) * Fix error running unit tests (#2940) When running tests, the following error occurs: VSTest: Could not locate executable. h... — committed to dnnsoftware/Dnn.Platform by valadas 5 years ago
- Updating development with recent changes on release/9.4.x (#2964) * Fix error running unit tests (#2940) When running tests, the following error occurs: VSTest: Could not locate executable. h... — committed to DnnSoftwarePersian/Dnn.Platform by valadas 5 years ago
Looking forward to the fix. This is the workaround I’ve been using:
Then just wrap your settings:
(See https://github.com/Microsoft/vswhere/wiki/Find-VSTest.)
I had the same issue - as @phillipsj already mentioned, the ToolPath did the trick (even it is not super “clean”)