By using VSTest.Console.exe, we can generate trx report through visual studio command prompt for our C# unit test cases. We can find VSTest.Console.exe in C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow folder if you use Microsoft Visual Studio 2017.
Open Microsoft Visual Studio 2017 command prompt and execute below command to generate a .trx report.
VSTest.Console.exe E:\Applications\MyUnitTestCase.dll /Settings:Local.RunSettings
/InIsolation /TestCaseFilter:"Priority=1" /Logger:trx
Here MyUnitTestCase.dll is my unit test case project dll stored at E:\Applications\ folder.
By executing above command, it generates the .trx report at TestResults folder under working directory.