-
-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for .NET Core #112
Comments
Using the file the test file for OpenCover.xml With the parameters |
As you said, you can execute ReportGenerator with Mono But a dotnet core version of ReportGenerator totally makes sense. |
I just tried to migrate the code base to dotnet core. What I would suggest:
Disadvantages: |
Changed the title as ReportGenerator already supports Mac and Linux using Mono, was not aware of that. Thanks for pointing it out! |
I released a first version which supports .NET Core: Usage is described here: Let me know if this works for you or if you have any issues. |
Had issues with dotnet --version 2.0.0 upgraded to latest 2.1.104 and it worked with
Generated the report with some complains about code not found in c:\temp.
Total tests: 167. Passed: 132. Failed: 35. Skipped: 0. |
To build the project you could also use What's more interesting to me:
|
@danielpalme git cloned the repo, changed to branch v4 and built from source using Then ran using Added AppVeyor config to ReportGenerator only two tests failing :) |
Managed to quickly setup in Travis to run the tests with dotnet in Unix environment |
Added Visual Studio and Ubuntu image to AppVeyor, in Windows only 2 tests fail, for Linux 37 are failing. @danielpalme would you be interested in a pull request of the Travis/AppVeyor configs? |
As mentioned above, the build on Windows works best with On Linux many tests fail because all tests are based on Windows file paths, which don't exist on Linux. Currently a don't need any Travis/AppVeyor configs. I build and publish the Nuget packages with my local machine. What would be much more interesting to me: Does the published Nuget-package work for you on Linux? |
@danielpalme I used the pre-release nuget (4.0.0-alpha2) successfully on a linux machine (jenkins linux agent actually)! The only error I ran into was when trying to create a badge, it couldn't find the Verdana font. |
@xtiancapil: |
Created a new project with Installed ReportGenerator with command shown in Nuget.org One minor issue arguments do not support ~ Using full path
Report generated successfully on my Mac, console output
Badges generated successfully |
Could not get src\build.bat to build Similar issue locally, would you be able to help? First
Second
|
Using Docker and Ubuntu Linux Start Docker
within the container install sudo
Microsoft instructions from Get started with .NET for Linux
Installed dotnet core
Created a new sample project and added ReportGenerator
Get ReportGenerator files to test
Generate report for Html with OpenCover ran ok, badges failed same issue with Verdana.
I think there are no fonts installed in this Docker image
Copy generated report into host machine, "dotnet" is the name of the container |
Tried to find out if .Net knew the fonts folder, InstalledFontCollection (under System.Drawing.Text) is not available in .Net Core Edit: using System;
namespace FontsConsole
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello Fonts!");
Console.WriteLine("GetFontsPath: {0}",
Environment.GetFolderPath(Environment.SpecialFolder.Fonts));
}
}
} OSX dotnet run
Hello Fonts!
GetFontsPath: /Users/andre/Library/Fonts Docker Ubuntu there is no fonts folder root@40bb926b92c2:/Docker/FontsConsole# dotnet run
Hello Fonts!
GetFontsPath:
root@40bb926b92c2:/Docker/FontsConsole# |
@xtiancapil @andrericardo New release is available here: |
@danielpalme
https://ci.appveyor.com/project/andrericardo/reportgenerator/build/8/job/ud8aavn74yy4hkvy |
After installing Microsoft fonts with
Even in Docker Ubuntu generated the badges fine with Verdana for 4.0.0-alpha2
|
I'm closing this as the distributed package seems to work on Linux. |
Hi @danielpalme |
@arpit-nagar The only thing a can do: |
Thanks, @danielpalme for information. |
Is it normal that I have to use the dll explicitly? I am running this in the microsoft/dotnet:2.0-sdk linux container and install the nuget package with |
@Hermain
How to use the packages is explained in the description of the Nuget pages or here: The global tool only works if you already installed .NET Core 2.1 Preview. |
Thank you for the quick answer. |
@Hermain
A CliTool is installed differently than a regular package. |
@danielpalme will we have a new pre-release that supports the just released dotnet core 2.1 version? I saw that global tools built with the 2.1 rc must be recompiled to work with the released version. |
@xtiancapil Does this work for you? |
@danielpalme it works great! Thanks! |
Hello @danielpalme, I am trying to setup ReportGenerator using command line. I am also getting same error as mentioned in above thread related to "No executable found matching command "dotnet-reportgenerator.dll". I am using 4.0.0-rc3 version and trying to run using VSTS build agent (Linux Hosted Preview). I have attached unit test project file and build pipeline settings for your reference. Could you please let me know, if I am missing any configuration? |
Probably all you have to do, is set your working directory to the directory which contains the *.csproj file: Alternative: |
@danielpalme - Thanks for your help. Once I have setup Working directory then it's working as expected. Thanks a lot. I have one more query regarding input reports files. All code coverage files generated by coverlet tool are placed in their respective unit test directory. Is there any way where ReportGenerator tool can look for all files having name "coverage.cobertura.xml" in given working directory. I had tried with below command but it didn't fetch all coverage files from all sub folders and so on. dotnet reportgenerator "-reports:$(System.DefaultWorkingDirectory)/**/coverage.cobertura.xml" "-targetdir:$(System.DefaultWorkingDirectory)/testresults/coverage/reports" "-reporttypes:Cobertura" With above command, it had fetch only single coverage.cobetura.xml file. Looks like tool didn't look into sub directories at all. Kindly let me know if it possible or not. |
You can use wilcards
you should be able to use a pattern like: |
This is not really an issue, just wonder if you considered this?
Someone started the question on Reddit .NET Code coverage tools for Linux/Ubuntu?
At the moment there is not a single coverage tool for dotnet core https://github.com/dotnet/corefx/issues/17107
But seems OpenCover is on track to have dotnet core support soon OpenCover/opencover#703
After that I think it would be nice to be able to generate the report with ReportGenerator :)
Without any changes to ReportGenerator I was able to ran it from Visual Studio Community 2017 Mac using Mono.
Not sure how much work it is to convert a Mono to dotnet project.
At the moment learned that you can deploy dotnet core by adding the RuntimeIdentifiers
Publish it with
$ dotnet publish -c release -r osx.10.12-x64
Then you get a console application runnable from bash
$ /Users/andre/Projects/SampleCoreConsole/bin/Release/netcoreapp2.0/osx.10.12-x64/publish/SampleCoreConsole
The text was updated successfully, but these errors were encountered: