Dotnet Test command issue
I am using VSTS for both hosting my code and building/deploying stuff. Amongst them I have a couple of .net core build pipelines, and I am using the builtin VSTS Dotnet Core build task for most Dotnet jobs.
I am not sure when this feature came out, but about a week ago my builds started to break with a failure in the Dotnet Test that looked like this:
7-11-10T22:42:08.4779946Z MSBUILD : error MSB1008: Only one project can be specified. 2017-11-10T22:42:08.4779946Z Switch: trx
That did not make much sense to me, until I noticed the command looked a little funny:
[command]D:\VSTSAgent\_work\_tool\dncs\2.0.2\x64\dotnet.exe test D:\VSTSAgent\_work\4\s\Test\FactusAviation.UITests\FactusAviation.UITests.csproj --configuration release --logger:TRX --logger trx --results-directory D:\VSTSAgent\_work\_temp
The issues was that the --logger switch was supplied twice. I used to have it set as a property in the "Arguments" part of the task.
But a new checkbox has appeared on the task. "Publish test results". And when you check that box, the --logger:TRX argument is already set on the
dotnet test command.
So if you see that error - MSB1008 in the Dotnet test, check if that might be your issue.
Publishing test results
Another benefit to this checkbox, is what it says on the box ... it publishes the test results. :-)
So - if you like me, had a "publish test results" task as part of your build pipeline, go ahead and remove that. The Dotnet Test does the job for you now.
Only thing missing is documentation of this task. The official docs.microsoft.com for the Dotnet task, still point to the nuget task documentation. Hope they fix that soon.