Can I use mstest.exe without installing Visual Stu

2019-01-12 16:51发布

I want to use mstest.exe to run my unit test on build server, but I don't want to install Visual Studio on the build server. Can I just install MSTest without Visual Studio?

8条回答
虎瘦雄心在
2楼-- · 2019-01-12 17:33

MSTest was announced for .NET Core users. The announcement has usage example with the dotnet tool. I haven't figured myself how to get the standalone mstest executable.

查看更多
SAY GOODBYE
3楼-- · 2019-01-12 17:41

I just got this working on my servers without installing the Visual Studio 2017 IDE. My requirement was

  • Build projects
  • Build test projects
  • Run tests using VSTest (I believe it is a similar process for MSTest)

I had to do a combination of a few things stated in other answers and then also another one here.

VS2017:

  1. BuildTools - This can be found on the Microsoft downloads page, and then scroll down to "Tools for Visual Studio 2017" -> "Build Tools for Visual Studio 2017"
  2. TestAgent - This can be found on the Microsoft downloads page, and then scroll down to "Tools for Visual Studio 2017" -> "Agents for Visual Studio 2017"
  3. Nuget Package to include the visual studio unit testing dll - This can be found here

Step 3 was to fix the following issue:

"Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework""

Which then caused:

"error CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) "

I did not have to add any references to the project. However, the path to the vstest.console.exe is contained in the TestAgent folder (for me it was "C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\CommonExtensions\Microsoft\TestWindow")

查看更多
登录 后发表回答