'MSTest: "File extension specified '.dll' is not a valid test extension"
I have a test project in VS2010, and I need to run the unit tests from command line. On one machine the following scenario works just fine:
1) Build the tests via "MSBuild test_project.csproj"
2) Run the tests via "MSTest /testcontainer:test_project.dll"
But on the other machine the 2nd step produced a weird error message, namely: "File extension specified '.dll' is not a valid test extension"
Any idea how to tackle this?
Thanks!
Solution 1:[1]
Check the registry on a PC that has Visual Studio 2010 installed: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\EnterpriseTools\QualityTools\TestTypes\.
This contains all entries in regards to allowed extensions for MSTest. It would also probably be best to search for the test type keys (e.g. {13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b}) and making sure they exist (.dll must be in the list of allowed extensions)
Solution 2:[2]
If your 'other machine' is the build machine and there's no Visual Studio installed, you need to install Test Agent and Test controller (http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=1334).
Take a look at the post Running tests in mstest without installing the VS IDE (http://blogs.msdn.com/b/anutthara/archive/2009/12/16/running-tests-in-mstest-without-installing-the-vs-ide.aspx)
Solution 3:[3]
If you are missing any of the following files it may cause this exception:
The files can be in the same directory or any configured directory. Configured locations can be found in MSTest.exe.config as an attribute on the probing element.
Solution 4:[4]
I ran into this same problem with Visual Studio 2019, and it fact it was on a single computer. For one user account, things worked fine, but for another account, I got this error.
I realized that for the second user account, I had never launched Visual Studio.
To resolve the problem, all I had to do was to log in as that second user account and launch Visual Studio, and then MSTest worked successfully afterwards.
Solution 5:[5]
I've read here and it says "mstest is obsolete" now. Please use vstest - I was facing same issue on GitHub Actions while running the workflow on self hosted runner.
Using VSTest issue has been fixed.
Note: Please follow the command line syntax carefully to avoid unexpected issues.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Wai Ha Lee |
| Solution 2 | Nikita R. |
| Solution 3 | N-ate |
| Solution 4 | Joe Savage |
| Solution 5 | pedram |

