Today I decided to start upgrading yo team to the .csproj project format for .NET Core. Once I had a sample project it was time to create the build definition. Visual Studio Team Services has a template to build .NET Core so I decided to start with that.

The template looked promising because it had add the required steps including running my unit tests.

However, after my build was done I did not have any test results.

After reviewing my build log I could see tests were executed.

After doing some research I realized I had to instruct the test task to write out a log file and add a task to publish the results. To have a log file generated during the test run add following argument to the test task:
--logger:trx

With that argument in place a .trx file will be created. Now all we have to do is publish it with the Publish Test Results task.

Use the following values to configure the task.
| Field Name |
Value |
| Version |
2.* (preview) |
| Display name |
Publish Test Results |
| Test result format |
VSTest |
| Test results files |
**/*.trx |
| Search folder |
$(System.DefaultWorkingDirectory) |
| Merge test results |
[check] |
| Test run title |
Unit |
| Platform |
$(BuildPlatform) |
| Configuration |
$(BuildConfiguration) |
| Upload test results files |
[check] |
Your final build should look like the image.

Now queue a new build and you should have test results.
