Skip to content
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

Closed
andrericardo opened this issue Nov 7, 2017 · 35 comments
Closed

Support for .NET Core #112

andrericardo opened this issue Nov 7, 2017 · 35 comments

Comments

@andrericardo
Copy link

andrericardo commented Nov 7, 2017

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.
screen shot 2017-11-07 at 22 45 40

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

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    **<RuntimeIdentifiers>osx.10.12-x64</RuntimeIdentifiers>**
  </PropertyGroup>

</Project>

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

screen shot 2017-11-07 at 23 26 45

@andrericardo
Copy link
Author

Using the file the test file for OpenCover.xml

With the parameters
"-reports:/Users/andre/Projects/ReportGenerator/src/Testprojects/CSharp/Reports/OpenCover.xml" "-targetdir:/Users/andre/Projects/temp"

Managed to generate the report :D
screen shot 2017-11-07 at 23 51 58

@danielpalme
Copy link
Owner

danielpalme commented Nov 8, 2017

As you said, you can execute ReportGenerator with Mono
This is possible for >2 years now, after dropping the dependency to log4net. See #26

But a dotnet core version of ReportGenerator totally makes sense.
I will see what I can do about that. But it will take some time to get finished.

@danielpalme
Copy link
Owner

I just tried to migrate the code base to dotnet core.
I got it working with some modifications.

What I would suggest:

  • Create a netstandard2.0 library called ReportGenerator.Core.dll. This can be used directly with dotnet core
  • Create a net461 console application ReportGenerator.exe, which is actually a wrapper for users who work with the full .NET Framework

Disadvantages:
Since ReportGenerator.exe would be dependent on a netstandard2.0 library, it would require at least version 4.6.1 of the .NET Framework instead of version 4.0 (which is available almost everywhere).

@andrericardo andrericardo changed the title Support for Mac and Linux Support for .NET Core Nov 8, 2017
@andrericardo
Copy link
Author

Changed the title as ReportGenerator already supports Mac and Linux using Mono, was not aware of that. Thanks for pointing it out!

danielpalme added a commit that referenced this issue Apr 16, 2018
#126: Usage of multiple cores during report generation
#127: Fixed coverage calculation for NCover
New: Improved Latex and XML reports
Change: Dropped support for PartCover
@danielpalme
Copy link
Owner

danielpalme commented Apr 16, 2018

I released a first version which supports .NET Core:
https://www.nuget.org/packages/ReportGenerator/4.0.0-alpha2

Usage is described here:
https://github.com/danielpalme/ReportGenerator/tree/v4#usage

Let me know if this works for you or if you have any issues.

@andrericardo
Copy link
Author

Had issues with dotnet --version 2.0.0 upgraded to latest 2.1.104 and it worked with

dotnet build src/ReportGenerator.Console.NetCore/ReportGenerator.Console.NetCore.csproj

dotnet src/target/bin/Debug/ReportGenerator.dll "-reports:src/Testprojects/CSharp/Reports/OpenCover.xml" "-targetdir:temp"

Generated the report with some complains about code not found in c:\temp.
File 'C:\temp\AbstractClass.cs' does not exist (any more).

dotnet test src/ReportGenerator.Core.Test/ReportGenerator.Core.Test.csproj

Total tests: 167. Passed: 132. Failed: 35. Skipped: 0.
Test Run Failed.
Test execution time: 3.9705 Seconds

@danielpalme
Copy link
Owner

To build the project you could also use src\build.bat.

What's more interesting to me:
Did you install the Nuget package (https://www.nuget.org/packages/ReportGenerator/4.0.0-alpha2) and generate a report using:

dotnet ReportGenerator.dll "-reports:coverage.xml" "-targetdir:C:\report"

@andrericardo
Copy link
Author

andrericardo commented Apr 17, 2018

@danielpalme git cloned the repo, changed to branch v4 and built from source using dotnet build src/ReportGenerator.Console.NetCore/ReportGenerator.Console.NetCore.csproj

Then ran using dotnet src/target/bin/Debug/ReportGenerator.dll "-reports:src/Testprojects/CSharp/Reports/OpenCover.xml" "-targetdir:temp"

screen shot 2018-04-17 at 20 01 14

Added AppVeyor config to ReportGenerator
https://ci.appveyor.com/project/andrericardo/reportgenerator/build/job/390ujb3uui2n38q7

only two tests failing :)
https://ci.appveyor.com/project/andrericardo/reportgenerator/build/job/390ujb3uui2n38q7/tests

@andrericardo
Copy link
Author

Managed to quickly setup in Travis to run the tests with dotnet in Unix environment
https://travis-ci.org/andrericardo/ReportGenerator/jobs/367893170#L1314

@andrericardo
Copy link
Author

Added Visual Studio and Ubuntu image to AppVeyor, in Windows only 2 tests fail, for Linux 37 are failing.
https://ci.appveyor.com/project/andrericardo/reportgenerator

@danielpalme would you be interested in a pull request of the Travis/AppVeyor configs?

@danielpalme
Copy link
Owner

As mentioned above, the build on Windows works best with src\build.bat.
The all tests will pass.

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?

@xtiancapil
Copy link

@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.

@danielpalme
Copy link
Owner

@xtiancapil:
Thanks for your feedback. Would Arial be available? If yes, I would change the font.

@andrericardo
Copy link
Author

dotnet --version
2.1.104

OSX version
10.13.4

Created a new project with
dotnet new console

Installed ReportGenerator with command shown in Nuget.org
dotnet add package ReportGenerator --version 4.0.0-alpha2

One minor issue arguments do not support ~

screen shot 2018-04-20 at 08 36 49

Using full path

dotnet ~/.nuget/packages/reportgenerator/4.0.0-alpha2/tools/ReportGenerator.dll "-reports:/Users/andre/Projects/ReportGenerator/src/Testprojects/CSharp/Reports/OpenCover.xml" "-targetdir:temp"

Report generated successfully on my Mac, console output

Loading report '/Users/andre/Projects/ReportGenerator/src/Testprojects/CSharp/Reports/OpenCover.xml'
 Preprocessing report
 Initiating parser for OpenCover
  Current Assembly: Test
Initializing report builders for report types: Html
Analyzing 17 classes
 Creating report 4/17 (Assembly: Test, Class: Test.AbstractClass)
 Creating report 4/17 (Assembly: Test, Class: Test.AbstractClass_SampleImpl1)
 Creating report 4/17 (Assembly: Test, Class: Test.AbstractGenericClass`2)
 Creating report 4/17 (Assembly: Test, Class: Test.AbstractClass_SampleImpl2)
 File 'C:\temp\AbstractClass.cs' does not exist (any more).
 File 'C:\temp\GenericClass.cs' does not exist (any more).
 File 'C:\temp\AbstractClass.cs' does not exist (any more).
 File 'C:\temp\AbstractClass.cs' does not exist (any more).
 Creating report 5/17 (Assembly: Test, Class: Test.AnalyzerTestClass)
 Creating report 7/17 (Assembly: Test, Class: Test.ClassWithExcludes)
 Creating report 8/17 (Assembly: Test, Class: Test.CodeContract_Contract)
 File 'C:\temp\ClassWithExcludes.cs' does not exist (any more).
 File 'C:\temp\AnalyzerTestClass.cs' does not exist (any more).
 File 'C:\temp\CodeContract_Contract.cs' does not exist (any more).
 Creating report 6/17 (Assembly: Test, Class: Test.AsyncClass)
 File 'C:\temp\AsyncClass.cs' does not exist (any more).
 Creating report 9/17 (Assembly: Test, Class: Test.CodeContract_Target)
 File 'C:\temp\CodeContract_Target.cs' does not exist (any more).
 Creating report 12/17 (Assembly: Test, Class: Test.PartialClassWithAutoProperties)
 Creating report 10/17 (Assembly: Test, Class: Test.GenericClass`2)
 File 'C:\temp\PartialClassWithAutoProperties.cs' does not exist (any more).
 File 'C:\temp\GenericClass.cs' does not exist (any more).
 File 'C:\temp\PartialClassWithAutoProperties2.cs' does not exist (any more).
 Creating report 11/17 (Assembly: Test, Class: Test.PartialClass)
 File 'C:\temp\PartialClass.cs' does not exist (any more).
 File 'C:\temp\PartialClass2.cs' does not exist (any more).
 Creating report 13/17 (Assembly: Test, Class: Test.Program)
 Creating report 14/17 (Assembly: Test, Class: Test.SomeModel)
 File 'C:\temp\Program.cs' does not exist (any more).
 Creating report 15/17 (Assembly: Test, Class: Test.SomeClass)
 File 'C:\temp\NotMatchingFileName.cs' does not exist (any more).
 Creating report 16/17 (Assembly: Test, Class: Test.TestClass)
 File 'C:\temp\TestClass.cs' does not exist (any more).
 Creating report 17/17 (Assembly: Test, Class: Test.TestClass2)
 File 'C:\temp\TestClass2.cs' does not exist (any more).
 Creating summary
Report generation took 0.3 seconds

Index in Firefox
screen shot 2018-04-20 at 08 41 58

Badges generated successfully
dotnet ~/.nuget/packages/reportgenerator/4.0.0-alpha2/tools/ReportGenerator.dll "-reports:/Users/andre/Projects/ReportGenerator/src/Testprojects/CSharp/Reports/OpenCover.xml" "-targetdir:temp" -reporttypes:Badges

screen shot 2018-04-20 at 08 49 29

@andrericardo
Copy link
Author

Could not get src\build.bat to build
https://ci.appveyor.com/project/andrericardo/reportgenerator/build/job/4u97879vkbuq4lj2

Similar issue locally, would you be able to help?

First msbuild Testprojects/CSharp/Project/Test_CSharp.csproj /t:Restore /v:m worked:

Microsoft (R) Build Engine version 15.4.0.0 (xplat-master/67e8006d Thu Mar  8 17:15:24 EST 2018) for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 54.79 ms for /Users/andre/Projects/ReportGenerator/src/Testprojects/CSharp/Project/Test_CSharp.csproj.

Second msbuild build.proj /t:Restore /v:m

Microsoft (R) Build Engine version 15.4.0.0 (xplat-master/67e8006d Thu Mar  8 17:15:24 EST 2018) for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

/Users/andre/Projects/ReportGenerator/src/build.proj(23,3): error MSB4019: The imported project "/.nuget/packages/msbuildtasks/1.5.0.235/tools/MSBuild.Community.Tasks.Targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

@andrericardo
Copy link
Author

andrericardo commented Apr 20, 2018

Using Docker and Ubuntu Linux

Start Docker

docker run -it ubuntu bash

within the container install sudo

apt-get update && \
      apt-get -y install sudo

sudo apt-get install curl -y

Microsoft instructions from Get started with .NET for Linux

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'

Installed dotnet core

sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.1.105

Created a new sample project and added ReportGenerator

dotnet new console -o myApp
cd myApp
dotnet add package ReportGenerator --version 4.0.0-alpha2

Get ReportGenerator files to test

cd
curl -LOk https://github.com/danielpalme/ReportGenerator/archive/v4.tar.gz
tar -zxvf v4.tar.gz

Generate report for Html with OpenCover ran ok, badges failed same issue with Verdana.

# dotnet ~/.nuget/packages/reportgenerator/4.0.0-alpha2/tools/ReportGenerator.dll "-reports:/root/ReportGenerator-4/src/Testprojects/CSharp/Reports/OpenCover.xml" "-targetdir:/tmp/DockerReportGenerator" -reporttypes:"Html;Badges"
Loading report '/root/ReportGenerator-4/src/Testprojects/CSharp/Reports/OpenCover.xml'
 Preprocessing report
 Initiating parser for OpenCover
  Current Assembly: Test
Initializing report builders for report types: Html, Badges
Analyzing 17 classes
 Creating report 1/17 (Assembly: Test, Class: Test.AbstractClass)
 Creating report 2/17 (Assembly: Test, Class: Test.AbstractClass_SampleImpl1)
 File 'C:\temp\AbstractClass.cs' does not exist (any more).
 File 'C:\temp\AbstractClass.cs' does not exist (any more).
 Creating report 3/17 (Assembly: Test, Class: Test.AbstractClass_SampleImpl2)
 File 'C:\temp\AbstractClass.cs' does not exist (any more).
 Creating report 4/17 (Assembly: Test, Class: Test.AbstractGenericClass`2)
 File 'C:\temp\GenericClass.cs' does not exist (any more).
 Creating report 5/17 (Assembly: Test, Class: Test.AnalyzerTestClass)
 File 'C:\temp\AnalyzerTestClass.cs' does not exist (any more).
 Creating report 6/17 (Assembly: Test, Class: Test.AsyncClass)
 File 'C:\temp\AsyncClass.cs' does not exist (any more).
 Creating report 7/17 (Assembly: Test, Class: Test.ClassWithExcludes)
 File 'C:\temp\ClassWithExcludes.cs' does not exist (any more).
 Creating report 8/17 (Assembly: Test, Class: Test.CodeContract_Contract)
 File 'C:\temp\CodeContract_Contract.cs' does not exist (any more).
 Creating report 9/17 (Assembly: Test, Class: Test.CodeContract_Target)
 File 'C:\temp\CodeContract_Target.cs' does not exist (any more).
 Creating report 10/17 (Assembly: Test, Class: Test.GenericClass`2)
 File 'C:\temp\GenericClass.cs' does not exist (any more).
 Creating report 11/17 (Assembly: Test, Class: Test.PartialClass)
 File 'C:\temp\PartialClass.cs' does not exist (any more).
 File 'C:\temp\PartialClass2.cs' does not exist (any more).
 Creating report 12/17 (Assembly: Test, Class: Test.PartialClassWithAutoProperties)
 File 'C:\temp\PartialClassWithAutoProperties.cs' does not exist (any more).
 File 'C:\temp\PartialClassWithAutoProperties2.cs' does not exist (any more).
 Creating report 13/17 (Assembly: Test, Class: Test.Program)
 File 'C:\temp\Program.cs' does not exist (any more).
 Creating report 14/17 (Assembly: Test, Class: Test.SomeClass)
 File 'C:\temp\NotMatchingFileName.cs' does not exist (any more).
 Creating report 15/17 (Assembly: Test, Class: Test.SomeModel)
 Creating report 16/17 (Assembly: Test, Class: Test.TestClass)
 File 'C:\temp\TestClass.cs' does not exist (any more).
 Creating report 17/17 (Assembly: Test, Class: Test.TestClass2)
 File 'C:\temp\TestClass2.cs' does not exist (any more).
 Creating summary
  Error during rendering summary report (Report type: 'Badges'): Verdana could not be found
Report generation took 0.8 seconds

I think there are no fonts installed in this Docker image

$ fc-list
bash: fc-list: command not found

Copy generated report into host machine, "dotnet" is the name of the container
docker cp dotnet:/tmp/DockerReportGenerator/ /tmp/DockerReportGenerator

Firefox
screen shot 2018-04-20 at 11 01 39

@andrericardo
Copy link
Author

andrericardo commented Apr 20, 2018

Tried to find out if .Net knew the fonts folder, InstalledFontCollection (under System.Drawing.Text) is not available in .Net Core

Edit:
Support for System.Drawing
https://github.com/dotnet/corefx/issues/20325
How to have System.Drawing including list of supported fonts
https://developers.de/2018/01/22/how-to-use-system-drawing-in-net-core/

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#

@danielpalme
Copy link
Owner

danielpalme commented Apr 21, 2018

@xtiancapil
I replaced Verdana with Arial. Arial should be available on every system. Docker probably can't be supported here, since it does not have any fonts.

@andrericardo
I fixed the problem "Second msbuild build.proj /t:Restore /v:m" you mentioned here: #112 (comment)
src\built.bat should now work.

New release is available here:
https://www.nuget.org/packages/ReportGenerator/4.0.0-alpha3

@andrericardo
Copy link
Author

@danielpalme
I'm going to try to install some fonts in the default Docker Ubuntu image to test the badges.
Still seeing issues with build.bat, care to have a look?

cd src
.\build.bat
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
C:\projects\reportgenerator\src\Testprojects\CSharp\Project\Test_CSharp.csproj : error MSB4057: The target "Restore" does not exist in the project.
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(724,5): error : The OutputPath property is not set for project 'build.proj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Debug'  Platform=''.  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [C:\projects\reportgenerator\src\build.proj]
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(724,5): error : The OutputPath property is not set for project 'build.proj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Debug'  Platform=''.  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [C:\projects\reportgenerator\src\build.proj]
Command exited with code 1

https://ci.appveyor.com/project/andrericardo/reportgenerator/build/8/job/ud8aavn74yy4hkvy

@andrericardo
Copy link
Author

After installing Microsoft fonts with

apt-get install ttf-mscorefonts-installer

Even in Docker Ubuntu generated the badges fine with Verdana for 4.0.0-alpha2

dotnet ~/.nuget/packages/reportgenerator/4.0.0-alpha2/tools/ReportGenerator.dll "-reports:/root/ReportGenerator-4/src/Testprojects/CSharp/Reports/OpenCover.xml" "-targetdir:/Docker/DockerReportGenerator" -reporttypes:"Html;Badges"
Loading report '/root/ReportGenerator-4/src/Testprojects/CSharp/Reports/OpenCover.xml'
 Preprocessing report
 Initiating parser for OpenCover
  Current Assembly: Test
Initializing report builders for report types: Html, Badges
Analyzing 17 classes
 Creating report 2/17 (Assembly: Test, Class: Test.AbstractClass_SampleImpl1)
 Creating report 2/17 (Assembly: Test, Class: Test.AbstractClass)
 File 'C:\temp\AbstractClass.cs' does not exist (any more).
 File 'C:\temp\AbstractClass.cs' does not exist (any more).
 Creating report 3/17 (Assembly: Test, Class: Test.AbstractClass_SampleImpl2)
 File 'C:\temp\AbstractClass.cs' does not exist (any more).
 Creating report 4/17 (Assembly: Test, Class: Test.AbstractGenericClass`2)
 File 'C:\temp\GenericClass.cs' does not exist (any more).
 Creating report 5/17 (Assembly: Test, Class: Test.AnalyzerTestClass)
 File 'C:\temp\AnalyzerTestClass.cs' does not exist (any more).
 Creating report 6/17 (Assembly: Test, Class: Test.AsyncClass)
 File 'C:\temp\AsyncClass.cs' does not exist (any more).
 Creating report 7/17 (Assembly: Test, Class: Test.CodeContract_Contract)
 File 'C:\temp\CodeContract_Contract.cs' does not exist (any more).
 Creating report 8/17 (Assembly: Test, Class: Test.ClassWithExcludes)
 File 'C:\temp\ClassWithExcludes.cs' does not exist (any more).
 Creating report 9/17 (Assembly: Test, Class: Test.CodeContract_Target)
 File 'C:\temp\CodeContract_Target.cs' does not exist (any more).
 Creating report 10/17 (Assembly: Test, Class: Test.PartialClass)
 File 'C:\temp\PartialClass.cs' does not exist (any more).
 File 'C:\temp\PartialClass2.cs' does not exist (any more).
 Creating report 11/17 (Assembly: Test, Class: Test.GenericClass`2)
 File 'C:\temp\GenericClass.cs' does not exist (any more).
 Creating report 12/17 (Assembly: Test, Class: Test.Program)
 File 'C:\temp\Program.cs' does not exist (any more).
 Creating report 13/17 (Assembly: Test, Class: Test.PartialClassWithAutoProperties)
 File 'C:\temp\PartialClassWithAutoProperties.cs' does not exist (any more).
 File 'C:\temp\PartialClassWithAutoProperties2.cs' does not exist (any more).
 Creating report 14/17 (Assembly: Test, Class: Test.SomeClass)
 File 'C:\temp\NotMatchingFileName.cs' does not exist (any more).
 Creating report 15/17 (Assembly: Test, Class: Test.SomeModel)
 Creating report 16/17 (Assembly: Test, Class: Test.TestClass)
 File 'C:\temp\TestClass.cs' does not exist (any more).
 Creating report 17/17 (Assembly: Test, Class: Test.TestClass2)
 File 'C:\temp\TestClass2.cs' does not exist (any more).
 Creating summary
Report generation took 1.1 seconds

screen shot 2018-04-21 at 10 44 48

Alpha3
screen shot 2018-04-21 at 10 47 52

dotnet ~/.nuget/packages/reportgenerator/4.0.0-alpha3/tools/ReportGenerator.dll "-reports:/root/ReportGenerator-4/src/Testprojects/CSharp/Reports/OpenCover.xml" "-targetdir:/Docker/DockerReportGenerator-alpha3" -reporttypes:"Html;Badges"
Loading report '/root/ReportGenerator-4/src/Testprojects/CSharp/Reports/OpenCover.xml'
 Preprocessing report
 Initiating parser for OpenCover
  Current Assembly: Test
Initializing report builders for report types: Html, Badges
Analyzing 17 classes
 Creating report 2/17 (Assembly: Test, Class: Test.AbstractClass)
 Creating report 2/17 (Assembly: Test, Class: Test.AbstractClass_SampleImpl1)
 File 'C:\temp\AbstractClass.cs' does not exist (any more).
 File 'C:\temp\AbstractClass.cs' does not exist (any more).
 Creating report 3/17 (Assembly: Test, Class: Test.AbstractClass_SampleImpl2)
 File 'C:\temp\AbstractClass.cs' does not exist (any more).
 Creating report 4/17 (Assembly: Test, Class: Test.AbstractGenericClass`2)
 File 'C:\temp\GenericClass.cs' does not exist (any more).
 Creating report 5/17 (Assembly: Test, Class: Test.AnalyzerTestClass)
 File 'C:\temp\AnalyzerTestClass.cs' does not exist (any more).
 Creating report 6/17 (Assembly: Test, Class: Test.AsyncClass)
 File 'C:\temp\AsyncClass.cs' does not exist (any more).
 Creating report 7/17 (Assembly: Test, Class: Test.ClassWithExcludes)
 Creating report 8/17 (Assembly: Test, Class: Test.CodeContract_Target)
 File 'C:\temp\CodeContract_Target.cs' does not exist (any more).
 File 'C:\temp\ClassWithExcludes.cs' does not exist (any more).
 Creating report 9/17 (Assembly: Test, Class: Test.CodeContract_Contract)
 File 'C:\temp\CodeContract_Contract.cs' does not exist (any more).
 Creating report 10/17 (Assembly: Test, Class: Test.GenericClass`2)
 File 'C:\temp\GenericClass.cs' does not exist (any more).
 Creating report 11/17 (Assembly: Test, Class: Test.PartialClass)
 File 'C:\temp\PartialClass.cs' does not exist (any more).
 File 'C:\temp\PartialClass2.cs' does not exist (any more).
 Creating report 12/17 (Assembly: Test, Class: Test.Program)
 File 'C:\temp\Program.cs' does not exist (any more).
 Creating report 13/17 (Assembly: Test, Class: Test.PartialClassWithAutoProperties)
 File 'C:\temp\PartialClassWithAutoProperties.cs' does not exist (any more).
 File 'C:\temp\PartialClassWithAutoProperties2.cs' does not exist (any more).
 Creating report 14/17 (Assembly: Test, Class: Test.SomeClass)
 File 'C:\temp\NotMatchingFileName.cs' does not exist (any more).
 Creating report 15/17 (Assembly: Test, Class: Test.SomeModel)
 Creating report 16/17 (Assembly: Test, Class: Test.TestClass)
 File 'C:\temp\TestClass.cs' does not exist (any more).
 Creating report 17/17 (Assembly: Test, Class: Test.TestClass2)
 File 'C:\temp\TestClass2.cs' does not exist (any more).
 Creating summary
Report generation took 1.0 seconds

@danielpalme
Copy link
Owner

I'm closing this as the distributed package seems to work on Linux.
Building the project on Linux currently in not working (especially test execution), but this is not an issue for users of ReportGenerator.

@arpit-nagar
Copy link

Hi @danielpalme
I am using version 4.0.0-alpha3 on Linux CentOS and I am still getting error - Error during rendering summary report (Report type: 'Badges'): Arial could not be found.

@danielpalme
Copy link
Owner

@arpit-nagar
I can only render the PNGs if the font is available. There is no way around that.
You have to install it first.

The only thing a can do:
Change the order of image generation; i.e. generate the SVGs before the PNGs.
If PNG generation fails due to missing font, you have at least the SVGs.

@arpit-nagar
Copy link

Thanks, @danielpalme for information.
I will install fonts.

@Hermain
Copy link

Hermain commented May 28, 2018

Is it normal that I have to use the dll explicitly?
I would love to be able to do dotnet ReportGenerator.dll "-reports:coverage.xml" "-targetdir:C:\report" but instead I'm doing dotnet /root/.nuget/packages/reportgenerator/4.0.0-alpha8/tools/netcoreapp2.0/ReportGenerator.dll and it seems like everyone here is doing the same.

I am running this in the microsoft/dotnet:2.0-sdk linux container and install the nuget package with dotnet add package ReportGenerator --version 4.0.0-alpha8

@danielpalme
Copy link
Owner

danielpalme commented May 28, 2018

@Hermain
Please have a look at these two packages:

How to use the packages is explained in the description of the Nuget pages or here:
https://github.com/danielpalme/ReportGenerator/tree/v4#available-packages

The global tool only works if you already installed .NET Core 2.1 Preview.

@Hermain
Copy link

Hermain commented May 28, 2018

Thank you for the quick answer.
I added it to my project using dotnet add package dotnet-reportgenerator-cli --version 4.0.0-alpha6 , restored and rebuilt the project but I still get No executable found matching command "dotnet-reportgenerator" maybe I should create a new issue for this? I first added dotnet add package ReportGenerator --version 4.0.0-alpha8 but also with dotnet add package ReportGenerator --version 4.0.0-alpha6 I get the same.

@danielpalme
Copy link
Owner

danielpalme commented May 28, 2018

@Hermain
As mentioned in the description, you have to add this manually to your project file:

<DotNetCliToolReference Include="dotnet-reportgenerator-cli" Version="4.0.0-alpha6" />

A CliTool is installed differently than a regular package.
Does this work for you?

@xtiancapil
Copy link

@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.

@danielpalme
Copy link
Owner

@xtiancapil
Just published this new version:
https://www.nuget.org/packages/dotnet-reportgenerator-globaltool/4.0.0-alpha10

Does this work for you?

@xtiancapil
Copy link

@danielpalme it works great! Thanks!

@parivshah
Copy link

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.

image

image

Could you please let me know, if I am missing any configuration?

@danielpalme
Copy link
Owner

Probably all you have to do, is set your working directory to the directory which contains the *.csproj file:

advanced

Alternative:
Use the global tool: https://www.nuget.org/packages/dotnet-reportgenerator-globaltool/4.0.0-rc4

See also: #148, #152

@parivshah
Copy link

@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.

@danielpalme
Copy link
Owner

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 * in the path definition. It is currently not possible to use double wilcards ``**`.
If you solution/project has a structure like:

Project_1/testresults/coverage.cobertura.xml
Project_2/testresults/coverage.cobertura.xml
...
Project_N/testresults/coverage.cobertura.xml

you should be able to use a pattern like: */testresults/coverage.cobertura.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants