You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用VS2017的Vstest.console.exe运行VS2015测试?

Fixing "No suitable test runtime provider found" with vstest.console.exe in VS2015

Hey there! Let's work through this error you're seeing when running vstest.console.exe—since MsTest works fine, we know your tests themselves are valid, so the issue is likely with how vstest.console is finding the necessary test providers. Here are actionable steps to fix this:

  • Specify the Test Adapter Path explicitly
    vstest.console relies on test adapters (like the MsTest adapter) to discover and run tests. If the built version from GitHub isn't picking up the adapter automatically, point it directly to the VS2015 MsTest adapter directory. Run this command instead:

    "c:\VSTest\vstest\src\vstest.console\bin\Debug\net451\win7-x64\vstest.console.exe" "c:\mydll.dll" /TestAdapterPath:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\TestWindow\Extensions"
    

    The path above is the default location for VS2015's MsTest adapter—adjust it if your VS installation is in a different directory.

  • Use VS2015's Built-in vstest.console.exe
    The version you built from GitHub might be incompatible with VS2015's test framework. Try using the vstest.console.exe that comes bundled with your VS2015 installation instead. Run this command:

    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "c:\mydll.dll"
    

    This is the same runtime that MsTest uses under the hood, so it should work if MsTest runs your tests successfully.

  • Verify Test DLL Compatibility
    Ensure your test DLL targets a .NET framework version compatible with the vstest.console build you're using (you're using the net451 version). Check your test project's properties in VS2015: go to Project Properties > Application > Target framework and confirm it's set to .NET Framework 4.5.1 or lower.

  • Check for Discoverable Tests
    Make sure your test DLL actually contains discoverable tests. Run this command to list all tests in the DLL:

    "c:\VSTest\vstest\src\vstest.console\bin\Debug\net451\win7-x64\vstest.console.exe" "c:\mydll.dll" /ListTests
    

    If no tests show up, double-check that your test classes have the [TestClass] attribute and test methods have [TestMethod] attribute—these are required for MsTest-based tests to be discovered.

  • Try Building vstest.console in Release Mode
    Debug builds can sometimes have missing or incomplete components. Rebuild the vstest.console project in Release configuration, then use the Release version executable (found at c:\VSTest\vstest\src\vstest.console\bin\Release\net451\win7-x64\vstest.console.exe) to run your tests.

内容的提问来源于stack exchange,提问作者vivek singh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 07:29:27