There are just way too many dependencies to getting build & MSTest to work without VS installed, and it is most definitely not supported.
As long as the person who starts the build has a license, you do not need one for the build server. This has been the case since the dark days of 2005, and as long as there is edition parity then you are OK.
将“ msdia110.dll”从“ C: Program Files (x86) Microsoft Visual Studio 11.0 Common7 Packages Debugger”复制到“ MsTest/Assembly”
Register 'msdia110.dll' with c:/windows/syswow64/regsvr32.exe /i '../mstest/assemblies/msdia110.dll'(This threw an error, but for some reason it still worked. I ran it a couple times and tried different regsvr32.exe versions before I checked, but it's there in the registry)
添加环境变量“ mSTEST _ HOME”并将其设置为“ c: dev MSTEST”或您的路径。我在构建脚本中使用了环境变量。
如果您需要运行 mstest.exe webtest 工具,那么您可以安装 Visual Studio Enterprise 试用版,并确保至少运行一次(只要启动它) ,在这个帐户下测试将运行,不需要做任何额外的事情。因此,如果您的测试在 System 帐户下运行,那么您需要使用下面这样的代码
PS C:\agent> psexec -s cmd.exe
C:\Windows\system32>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\mstest.exe"
Microsoft (R) Test Execution Command Line Tool Version 15.0.27520.0
Copyright (c) Microsoft Corporation. All rights reserved.
Please specify tests to run, or specify the /publish switch to publish results.
For switch syntax, type "MSTest /help"
我没有添加任何参考项目。但是,vstest.console.exe 的路径包含在 TestAgent 文件夹中(对我来说,它是“ C: Program Files (x86) Microsoft Visual Studio 2017 TestAgent Common7 IDE CommonExtended Microsoft TestWindow”)