Custom activity with code throws error "Could not load file or assembly" at runtime

Hey everyone, its Deep here

I am trying to create custom activity with code using VS Code (not Visual Studio). I’ve created class library project for that and added two dependencies:

  1. UiPath.Workflow
  2. Pdfsharp

The whole project is compiled successfully and activity is also usable in UiPath. In UiPath also it gets compiled successfully.

But at runtime time it shows error immediately like: “Could not load file or assembly (Pdfsharp, version=6.1.0.0, culture=neutral). System could not find file”

If anyone had this type of error in past or have any idea about this please help me to resolve this.

Thanks,
Deep Patel

@deep.patel3868,

Is your project where you are using is same compatibility. As far as I know Pdfsharp is not yet compatible with Windows compatibility.

Try using it in Legacy Compatibility project. Sample Code:

Legacy Template.zip (174.6 KB)

Thanks,
Ashok :slight_smile:

Hi Ashok,

Thanks for reply!

But I am not able add my custom activity package in this windows legacy project. I am using .net 8.0 version of SDK to create custom activity project, I’ve not included any other version to support legacy compatibility or even not added suffix “-windows” in it, it just net8.0.

Another thing I want to add that after successful compilation it immediately throws error. Before Even UiPath executor is started.

Maybe this will help you more understanding my problem and where I am wrong.

Thanks,
Deep

Could not figure out the exact problem but it gets resolved when I created project in visual studio. And added pdfsharp using Manage NuGet packages.

Edit:

Adding pdfsharp with command line writing “pdfsharp” as “PDFsharp” solved my problem.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.