GHPReporter/Ghpr.Core

Getting could not load Ghpr.Core assembly error while running nunit3-console

Nabakamal opened this issue · 6 comments

Running nunit3-console.exe "My.dll" gives me this error:
Could not load file or assembly 'Ghpr.Core, Version=0.9.9.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Steps to reproduce this behaviour:

  1. Running nunit3-console.exe "My.dll" from this location {My}\packages\NUnit.ConsoleRunner.3.10.0\tools\ gives me this error.

Here is how my packages.config file looks like:
image

Expected behavior
The command should execute and my tests should be run. It is a VS2017 unit test project containing 2 simple Selenium tests.

Screenshots
image

Desktop (please complete the following information):

  • Browser: Chrome 75.something
  • Ghpr packages versions : Ghpr.Core v0.9.9.1, Ghpr.NUnit v0.9.9.1

Hi @Nabakamal !

Thank you for the issue.

Most likely you need to change corresponding .addins file for NUnit to start seeing the extension. Please usage section for more details: https://github.com/GHPReporter/Ghpr.NUnit#usage

Hi, sorry for the delayed response. I was on a vacation. My .addins file (..\packages\NUnit.ConsoleRunner.3.10.0\tools\nunit.nuget.addins) looks like this:

../../NUnit.Extension./**/tools/ # nuget v2 layout
../../../NUnit.Extension.
//tools/
../../../../NUnit.Extension.*/
/tools/ # nuget v3 layout
../../Ghpr.Core.0.9.9.1/lib/net452/Ghpr.Core.dll
../../Ghpr.NUnit.0.9.9.1/lib/net452/Ghpr.NUnit.dll

In spite of this, I get the errors I mentioned above. Please assist.

Hi @Nabakamal !
I was able to reproduce the issue using NUnit.Examples repository.

When the .addins file is configured like this:
image

there is an error:
image

The fix is to use the path to Ghpr.NUnit file from your build folder (bin/Debug by default).
In my case it was:
image

The run was successful after that:
image

I also raised an issue to fix it in the future: GHPReporter/Ghpr.NUnit#57
In general we should not do any modifications to .addins file after the issue is resolved.

Thank you.

Hi! Thank you for that fix...now, however, after making that change, I get this(may not be related to this issue):

image

Do you know what may be causing this? I am using this format:

nunit3-console.exe "C:\Path-to-my-DLL\My.dll"

My bad! Sorry. I had added an absolute path in the .addins file to the Ghpr.Nunit.dll. When I modified it to have a relative path (with a lot of ..s), the issue isn't coming up anymore. Thanks.

Thank you for confirming that the issue is fixed for you!

According to NUnit documentation:

Wildcards may be used for assembly entries and relative paths are interpreted based on the location of the .addins file

So it looks like NUnit supports only relative paths, that's why you were getting an error.

Closing the issue.