ReportToPDF compile error

Best practices, code snippets for common functionality, examples, and guidelines.
dominik_F
Posts: 15
Joined: Thu May 09, 2019 10:03 am

ReportToPDF compile error

Post by dominik_F » Fri May 31, 2019 9:30 am

Dear community,

I tried creating PDF reports for my TestSuites.
Therefore I added "Ranorex Automation Helpers" to my solution and added those to at the end of the teardown.
PDF creation basically worked, but all files were overwritten by the last one (as described by someone else in
https://www.ranorex.com/forum/viewtopic ... pdf#p53012 )

There I read to update the nuget packages which I did.
I now have the Automation Helper in Version 1.5.3 (may 8th 2019) and the ReportToPDF v1.0.16 (May 3rd)
Since the update, the solution won't compile anymore as a reference is missing and the namespace "Ranorex.PDF" is unknown (intelliSense proposes to use it, but when building, it tries to access a exe, that doesnt exist ->
The reference refers to " ...\RanorexAutomationHelpers\bin\Debug\Ranorex.ReportToPDF.exe". This file does not exist though or cannot be build due to the missing reference.

The error is in "ReportToPDFModule.cs Line 156
I have not manipulated the file and let it use the default parameters for paths and names.

EDIT: the error message is (in german): Dieser Verweis konnte nicht aufgelöst werden. Die Ranorex.ReportToPDF, Version=1.0.14.0, Culture=neutral, PublicKeyToken=null-Assembly wurde nicht gefunden. Stellen Sie sicher, dass die Assembly auf dem Datenträger vorhanden ist. (MSB3245)


br dominik

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: ReportToPDF compile error

Post by Support Team » Mon Jun 03, 2019 7:48 pm

Hi dominik_F,

I suspect there is some old reference still in the solution which needs to be removed. This is a difficult one to troubleshoot without actually seeing the solution. Are you able to provided a compressed copy of it? If you wish to troubleshoot this in a more private manner, please create a support ticket and we will be happy to more closely analyze your solution and find what is broken.

Looking forward to your reply!

Regards,
Ned

Dhundley
Posts: 9
Joined: Fri Nov 06, 2020 12:23 am

Re: ReportToPDF compile error

Post by Dhundley » Fri Mar 12, 2021 3:51 pm

i'm getting essentially the same error:

2021-03-11T22:50:08.9625141Z ##[error]RanorexAutomationHelpers\Modules\ReportToPDFModule.cs(154,12): Error CS0234: The type or namespace name 'PDF' does not exist in the namespace 'Ranorex' (are you missing an assembly reference?). I 've attached an image showing line 154 of the ReportToPDFModule.

The solution works for me when I run it on my own personal workstation and it works when I send it from my workstation over to a VM using the ranorex remote agent. It is failing in the build step of the pipeline agent job using MSBuild after I have checked in everything from my local repository up to the master repo in Azure and there is nothing left to commit/checkin (see second attachment called Commit). It is attempting to perform the build on the same VM that I do when I employ the remote agent from my workstation.

I'm relatively new to Ranorex. What am I missing here?
You do not have the required permissions to view the files attached to this post.

Dhundley
Posts: 9
Joined: Fri Nov 06, 2020 12:23 am

Re: ReportToPDF compile error

Post by Dhundley » Fri Mar 12, 2021 4:42 pm

Thought it might be helpful if I also attached a view of what the repo looks like in Azure. as you can see, the Ranorex Automation Helpers is part of the repo which includes the ReportToPDFModule. So why does my build have the message " The type or namespace name 'PDF' does not exist in the namespace 'Ranorex' (are you missing an assembly reference?)". it seems to be actually referring just to the PDF node part of Ranorex.PDF.Creator.CreatePDF in line 154. What's up with that?
You do not have the required permissions to view the files attached to this post.

raygoel
Posts: 12
Joined: Tue Sep 15, 2020 3:38 pm

Re: ReportToPDF compile error

Post by raygoel » Mon Apr 05, 2021 7:39 pm

I am facing the same issue. I have updated the reference but Azure still fails to build the solution.
Can anyone help with this please?

mrt
Posts: 257
Joined: Mon Mar 16, 2020 11:31 am

Re: ReportToPDF compile error

Post by mrt » Fri Jul 16, 2021 1:53 pm

facing the same issue, works locally, works with remote agent, but fails on Azure build pipeline.
I have updated to Rx 10.0 but the other posts are older than 10.0 release date, so it is maybe not related?

Curiously, I have two pipelines checking out the same source.
One fails when building the solution with the Report to PDF error.
The other one builds fine, but fails at the end of the test run where PDF is created.
I can't see any obvious difference or reason.

Edit: I cleaned up the work directory of the Azure Agent, now both fail with same error message
2021-07-16T13:23:35.2491355Z ResolveAssemblyReferences:
2021-07-16T13:23:35.2492756Z Primary reference "Ranorex.ReportToPDF".
2021-07-16T13:23:35.2628730Z ##[warning]C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2202,5): Warning MSB3245: Could not resolve this reference. Could not locate the assembly "Ranorex.ReportToPDF". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
@Support Team
How can we cleanup references or remove automation helpers completely and re-add them (if that helps)?
Due to sensitive data it is not possible to post the entire solution somewhere online.

Edit:
I created a new empty solution, just selected Add Ranorex Automation Helpers on the solution and it failed with exception:

Code: Select all

System.ApplicationException: Unable to find package 'Ranorex.AutomationHelpers'.
   at ICSharpCode.PackageManagement.ProcessPackageAction.ThrowPackageNotFoundError(String packageId)
   at ICSharpCode.PackageManagement.ProcessPackageAction.GetPackageIfMissing()
   at ICSharpCode.PackageManagement.ProcessPackageOperationsAction.BeforeExecute()
   at ICSharpCode.PackageManagement.ProcessPackageOperationsAction.HasPackageScriptsToRun()
   at ICSharpCode.PackageManagement.PackageActionRunner.ShouldRunActionsInConsole(IEnumerable`1 actions)
   at ICSharpCode.PackageManagement.PackageActionRunner.Run(IEnumerable`1 actions)
   at ICSharpCode.PackageManagement.InstallProjectTemplatePackagesCommand.InstallPackages()
   at ICSharpCode.PackageManagement.InstallProjectTemplatePackagesCommand.Run()
   at ICSharpCode.SharpDevelop.Internal.Templates.ProjectTemplate.RunOpenActions(ProjectCreateInformation projectCreateInformation)
   at Ranorex.Addins.RxSharpDevelopIDEService.TryCreateRanorexProject(String projectName, String projectFileName, String projectTemplateName, String language)
   at Ranorex.Addins.RxSharpDevelopIDEService.TryCreateRanorexHelpersProject()
   at Ranorex.Controls.Dialogs.AddRxHelpersViewModel.AddRxHelpersToTheProject()
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: ReportToPDF compile error

Post by odklizec » Mon Jul 19, 2021 7:44 am

Hi,

In my opinion, there is a problem with .Net version or something's broken related to .net or runtime libs on the failing machine? Are you sure the devops machine does have installed the same .Net and runtime libs as your local machine, where everything works? True, Ranorex installation should install all required libs, along with the Ranorex. But experience teaches us that some libs are not installed and are missing on the clean machine ;) So please make sure both machines features the same .Net and runtime libs. Eventually install .Net SDK package, which is usually missing on clean machine.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

mrt
Posts: 257
Joined: Mon Mar 16, 2020 11:31 am

Re: ReportToPDF compile error

Post by mrt » Mon Jul 19, 2021 8:01 am

Hi,

hmm, I have uninstalled Ranorex Studio on both machines (devops client and local machine) and then reinstalled it on both machines.
As you said, it did report all "prerequisites" are installed correctly.

But it may misses something.
Which .NET version should be used by Ranorex 10?
does it make any difference which platform is selection in project details?

Also on my local machine, where everything builds and works,
it fails when creating a new empty solution and try to add automation helpers to it.
That seems weird to me.

Even if the devops machine has "nothing" installed on it, shouldn't the ReportToPDF Module be brought in by the pipeline build?

Edit:
Ok, NET SDK was installed on both machines already.

If I run a task through the remote agent (also installed on the devops machine), it creates a PDF,
BUT it also throws an exception I have never seen before:
2021-07-19 09_21_59-Window.png
2021-07-19 09_21_21-Window.png
You do not have the required permissions to view the files attached to this post.

mrt
Posts: 257
Joined: Mon Mar 16, 2020 11:31 am

Re: ReportToPDF compile error

Post by mrt » Mon Jul 19, 2021 10:47 am

Ok, latest update:

I uninstalled RX 10 on both machines, and re-installed RX 9.5.3 again on both machines.

I setup a new pipeline based on the .NET desktop tasks like mentioned in the documentation.
https://www.ranorex.com/help/latest/int ... -pipeline/
This works (!), Reports are created and tests run flawlessy.
So I doubt it is an issue on the build machine with some missing prerequisites or such.

But - I can't get the RX official build task to work standalone.
In the documentation it reads that the official task replaces all other tasks previously mentioned.
At least for me - this is simply not true.

When adding the official task only, it does not find any *.exe because there is not even a bin-folder generated at the build machine.
This means to me, the solution is never built.

I can add the official build task AFTER the manual nuget restore and build task, there it works.
But adding it standalone does not work.

Any ideas?

@to all others suffering:
Add the Nuget restore task first in your pipeline, then the ReportToPDF was found in my case.
azure.png
You do not have the required permissions to view the files attached to this post.