Because of: https://github.com/Microsoft/vsts-tasks/issues/2357 would it possible to add switch for forcing styles to be inlined to report files? It of course would greatly increase the file sizes and it's by any standards wrong but since VSTS is apparently paranoid of meta tags and links, I would see this approach as a viable workaround.
Should be possible. Will come back to you within the next 1-2 weeks
Most appreciated!
Could you please test this release:
https://www.nuget.org/packages/ReportGenerator/2.5.8-beta1
You should use the following command line argument:
-reportypes:HtmlInline
instead of
-reportypes:Html
@danielpalme Gave this beta package a try. Works pretty well. Thanks!
@nulltoken
Did you test it with VSTS?
Indeed. Otherwise I wouldn't have reported my test :wink:
As the html is displayed within an iframe, navigating within the report is a bit clunky (lack of a link back to the main page, and mandatory usage of the right mouse button, then select the "back" menu item) but a definitive enhancement compared to previous behavior.


Few minor findings, though:
The chrome console displays messages similar to the one below:
Blocked script execution in 'https://xxxxxxxx.visualstudio.com/xxxxxxxxxxx-dddd-cccccc-dddd-qqqqqqqqqqqq/_鈥wse/000001/Code%20Coverage%20Report_13370/XXXXXXXX_1.htm' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
Similar test results here. Mr. Trump would say "This is HUUUGE, I mean, HUUUUUGE improvement". Lack of scripts is understandable, due to vsts' paranoia.
Well played Sir! Keep up the good work and don't hesitate to ask for another hand anytime! Would be happy to help!
could some one give a sample of how to integrate it with vsts
Some hints would be great. I would also like to add them to the wiki:
https://github.com/danielpalme/ReportGenerator/wiki/Integration
@dzfweb
I managed to create a basic setup with the following steps
Commit/Push a sample project to VSTS. I created this project:
VSTS_CoverageSample.zip It contains a .NET class library and a test project based on xUnit. It also contains two _bat_ files which:
Setup of build definition in VSTS. In this case I used the ".NET Desktop" template and made some modifications:
RunTests_$(BuildConfiguration).bat


Execute build and see results

Hope this helps!
@danielpalme thank you!!! It'll be realy helpful.
@dzfweb
I updated the wiki as well: https://github.com/danielpalme/ReportGenerator/wiki/Integration
thanks again @danielpalme,
another thing is how to do this whit MSTests? I'm not using xUnit, is it needed?
xUnit is not required.
You have to make some modifications:
mkdir TestResults
mkdir TestResults\reports
%userprofile%\.nuget\packages\opencover\4.6.519\tools\OpenCover.Console.exe -register:user -coverbytest:* -returntargetcode -mergebyhash -target:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "-targetargs:CalculatorTest\bin\Debug\CalculatorTest.dll /InIsolation /platform:x64" -filter:+[*]* "-output:TestResults\reports\opencover.xml"
%userprofile%\.nuget\packages\opencovertocoberturaconverter\0.2.6\tools\OpenCoverToCoberturaConverter.exe "-input:TestResults\reports\opencover.xml" "-sources:." "-output:TestResults\reports\cobertura.xml" "-includeGettersSetters:true"
%userprofile%\.nuget\packages\reportgenerator\3.1.1\tools\ReportGenerator.exe -reporttypes:HTMLInline "-reports:TestResults\reports\opencover.xml" "-targetdir:TestResults\reports" -verbosity:Info -historydir:TestResults\reports\history
Nice,
i think the path
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe won't work on vsts, wich path should i use?
Sorry, I don't know. I have used a local build agent.
Anyway, thank you so much for your time expended helping me, was realy helpful.
i've finally maked it works, but now i want to know if is possible to view the html generated inside the code coverage tab of build result.
My Publish code covarage:



IMHO, that's not possible in VSTS.
Which path did you use for _MSTest/vstest.console.exe_?
i've finally maked it works, but now i want to know if is possible to view the html generated inside the code coverage tab of build result.
I'm able to display the report in the Code Coverage tab by adding a step that renames index.htm to index.html.
Most helpful comment
@dzfweb
I managed to create a basic setup with the following steps
Commit/Push a sample project to VSTS. I created this project:
VSTS_CoverageSample.zip It contains a .NET class library and a test project based on xUnit. It also contains two _bat_ files which:
Setup of build definition in VSTS. In this case I used the ".NET Desktop" template and made some modifications:
RunTests_$(BuildConfiguration).batExecute build and see results

Hope this helps!