I am getting this error when I try to run unit tests via teamcity MyTeamCity version is 9.1 and I am using Visual Studio 2015. If I change the name of MSTest.exe or vstest.console.exe it throws another error about finding the files. Also I think the problem is not about my project version, because I could run MSTest.exe an vstest.console.exe with my test dll via command line. I have already tried to install visual studio 2013 test agents but I got same error when I tried to run MSTest.exe.
MSTest executable: C:\Program Files (x86)\Microsoft Visual Studio
14.0\Common7\IDE\MSTest.exe Command line params: [[/testcontainer:C:\TeamCity\buildAgent\work\6028ae3d00a3d06d\WebApi.Test\bin\Release\WebApi.Test.dll]
[/resultsfile:C:\TeamCity\buildAgent\temp\buildTmp\mstest_results_1461330948659.teamcity.trx]]
Starting:
C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe
#TeamCityImplicit in directory: C:\TeamCity\buildAgent\work\6028ae3d00a3d06d 2016-04-22 16:15:49,315
[13520] ERROR
JetBrains.TeamCity.GenericProcessSupport.GenericProcessArguments -
Failed Platform from: NATIVE, Failed to parse PlatformVersion: NATIVE
JetBrains.TeamCity.Utils.CommandLineParseException: Failed to parse
PlatformVersion: NATIVE at
JetBrains.TeamCity.Utils.Runtime.ParseUtil.ParseEnvironment(String
value) in
c:\BuildAgent\work\ad31cec0a1b0f083\src\Utils\src\Runtime\ParseUtil.cs:line
36 at
JetBrains.TeamCity.GenericProcessSupport.GenericProcessArguments.set_RuntimeVersionInternal(String
value) in
c:\BuildAgent\work\ad31cec0a1b0f083\src\GenericProcessSupport\src\GenericProcessArguments.cs:line
70 2016-04-22 16:15:49,929 [32004] ERROR
***JetBrains.TeamCity.Utils.Runtime.ParseUtil - Failed to load assembly
from file C:\Program Files (x86)\Microsoft Visual Studio
14.0\Common7\IDE\MSTest.exe: This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.*** (Exception
from HRESULT: 0x8013101B) System.BadImageFormatException: This
assembly is built by a runtime newer than the currently loaded runtime
and cannot be loaded. (Exception from HRESULT: 0x8013101B) at
System.Reflection.Assembly.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path) at
JetBrains.TeamCity.Utils.Runtime.ParseUtil.LoadAssembly(String value)
in
c:\BuildAgent\work\ad31cec0a1b0f083\src\Utils\src\Runtime\ParseUtil.cs:line
110 Failed to start process due to error:
JetBrains.TeamCity.Utils.CommandLineParseException: Failed to load
assembly from file C:\Program Files (x86)\Microsoft Visual Studio
14.0\Common7\IDE\MSTest.exe: ***This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. (Exception
from HRESULT: 0x8013101B)*** ---> System.BadImageFormatException: This
assembly is built by a runtime newer than the currently loaded runtime
and cannot be loaded. (Exception from HRESULT: 0x8013101B) at
System.Reflection.Assembly.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path) at
JetBrains.TeamCity.Utils.Runtime.ParseUtil.LoadAssembly(String value)
in c:\BuildAgent\work\ad31cec0a1b0f083\src\Utils\src\Runtime\ParseUtil.cs:line
110
--- End of inner exception stack trace --- at JetBrains.TeamCity.Utils.Runtime.ParseUtil.LoadAssembly(String value)
in
c:\BuildAgent\work\ad31cec0a1b0f083\src\Utils\src\Runtime\ParseUtil.cs:line
124 at
JetBrains.TeamCity.PlatformProcessRunner.PlatformSwitchBase.Main2(String[]
args) in
c:\BuildAgent\work\ad31cec0a1b0f083\src\PlatformProcessRunner\src\PlatformSwitchBase.cs:line
66 at
JetBrains.TeamCity.PlatformProcessRunner.PlatformSwitchBase.Main(String[]
args) in
c:\BuildAgent\work\ad31cec0a1b0f083\src\PlatformProcessRunner\src\PlatformSwitchBase.cs:line
24 Process exited with code -1
How ever this works fine:
C:\Users\*****>"C:\Program Files (x86)\Microsoft Visual Studio
14.0\Common7\IDE\ MSTest.exe" /testcontainer:"C:/TeamCity/buildAgent/work/6028ae3d00a3d06d/WebApi.
Test/bin/Release/WebApi.Test.dll"
/resultsfile:C:\TeamCity\buildAgent\temp\build
Tmp\mstest_results_1461330948659.teamcity.trx
And I'm getting this error when I try to use vstest.console.exe:
VSTest will report tests to TeamCity after run VSTest executable:
C:\Program Files (x86)\Microsoft Visual Studio
14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe
Command line params:
[[C:\TeamCity\buildAgent\work\6028ae3d00a3d06d\WebApi.Test\bin\Release\WebApi.Test.dll]
[/Logger:trx] [/Platform:x64]] Starting:
C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe
#TeamCityImplicit in directory: C:\TeamCity\buildAgent\work\6028ae3d00a3d06d 2016-04-22 16:37:54,082
[8032] ERROR
JetBrains.TeamCity.GenericProcessSupport.GenericProcessArguments -
Failed Platform from: NATIVE, Failed to parse PlatformVersion: NATIVE
JetBrains.TeamCity.Utils.CommandLineParseException: Failed to parse
PlatformVersion: NATIVE at
JetBrains.TeamCity.Utils.Runtime.ParseUtil.ParseEnvironment(String
value) in
c:\BuildAgent\work\ad31cec0a1b0f083\src\Utils\src\Runtime\ParseUtil.cs:line
36 at
JetBrains.TeamCity.GenericProcessSupport.GenericProcessArguments.set_RuntimeVersionInternal(String
value) in
c:\BuildAgent\work\ad31cec0a1b0f083\src\GenericProcessSupport\src\GenericProcessArguments.cs:line
70 2016-04-22 16:37:54,527 [21112] ERROR
JetBrains.TeamCity.Utils.Runtime.ParseUtil - Failed to load assembly
from file C:\Program Files (x86)\Microsoft Visual Studio
14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe:
***The module was expected to contain an assembly manifest. (Exception
from HRESULT: 0x80131018) System.BadImageFormatException: The module
was expected to contain an assembly manifest. (Exception from HRESULT:
0x80131018)*** at System.Reflection.Assembly.nLoadFile(String path,
Evidence evidence) at System.Reflection.Assembly.LoadFile(String path)
at JetBrains.TeamCity.Utils.Runtime.ParseUtil.LoadAssembly(String
value) in
c:\BuildAgent\work\ad31cec0a1b0f083\src\Utils\src\Runtime\ParseUtil.cs:line
110 Failed to start process due to error:
JetBrains.TeamCity.Utils.CommandLineParseException: Failed to load
assembly from file C:\Program Files (x86)\Microsoft Visual Studio
14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe:
The module was expected to contain an assembly manifest. (Exception
from HRESULT: 0x80131018) ---> System.BadImageFormatException: The
module was expected to contain an assembly manifest. (Exception from
HRESULT: 0x80131018) at System.Reflection.Assembly.nLoadFile(String
path, Evidence evidence) at System.Reflection.Assembly.LoadFile(String
path) at
JetBrains.TeamCity.Utils.Runtime.ParseUtil.LoadAssembly(String value)
in
c:\BuildAgent\work\ad31cec0a1b0f083\src\Utils\src\Runtime\ParseUtil.cs:line
110
--- End of inner exception stack trace --- at JetBrains.TeamCity.Utils.Runtime.ParseUtil.LoadAssembly(String value)
in
c:\BuildAgent\work\ad31cec0a1b0f083\src\Utils\src\Runtime\ParseUtil.cs:line
124 at
JetBrains.TeamCity.PlatformProcessRunner.PlatformSwitchBase.Main2(String[]
args) in
c:\BuildAgent\work\ad31cec0a1b0f083\src\PlatformProcessRunner\src\PlatformSwitchBase.cs:line
66 at
JetBrains.TeamCity.PlatformProcessRunner.PlatformSwitchBase.Main(String[]
args) in
c:\BuildAgent\work\ad31cec0a1b0f083\src\PlatformProcessRunner\src\PlatformSwitchBase.cs:line
24 Process exited with code -1
On the other hand this works fine via console:
C:\Users\*****>"C:/Program Files (x86)/Microsoft Visual Studio
14.0/Common7/IDE/CommonExtensions/Microsoft/TestWindow/vstest.console.exe"
C:/TeamCity/buildAgent
/work/6028ae3d00a3d06d/WebApi.Test/bin/Release/WebApi.Test.dll
User contributions licensed under CC BY-SA 3.0