Making Custom Activities with Dependent Dll files

Hello everyone,

Right now, I am trying to build a custom activity. The reason for this is that I need to use the PDFTron SDK. This relies on me using 2 .dll files as dependencies. Since these are not supported directly in UiPath, I have read I need to put them in a nuget package or custom activity.

While I did not have too much trouble building the custom activity, I have not been able to get my workflow to locate the dependent dlls. Right now, in my csproj file, I am specifying that they should be in "lib\net6.0-windows7.0". I have also tried placing them in "runtimes\win-x64-native" and had the same problem.

The project runs when I manually put the .dll files I need in the project folder, but how do I make them accessible at runtime as part of the nuget package for the custom activity.

Edit: I want to mention I have converted these files to zip, looked in the expected directory, and have confirmed that the .dll files have been copied to where I expect.

Thank you

@edevries

Please check this

Hope this helps

Cheers

1 Like

Thank you Anil,

I included this in my csproj file, but it is still not solving my problem. I have tried so many variations of editing the csproj file but it always cannot locate PDFTronC.dll or one of its dependencies.

<ItemGroup>
	<Content Include="PDFNetC.dll">
		<Pack>True</Pack>
		<PackagePath>\lib\net6.0-windows7.0</PackagePath>
	</Content>
	<Content Include="PDFTronDotNet.dll">
		<Pack>True</Pack>
		<PackagePath>\lib\net6.0-windows7.0</PackagePath>
	</Content>
</ItemGroup>

Edit: I have also confirmed when inspecting my nuget package file that these files are being put in lib\net6.0-windows7.0 but they cannot be located at runtime

@edevries

If you can that would great if you share your code here…we can check and try to find the issue

cheers

I solved this problem by using an Invoke Code activity. Before the core logic begins, I check if the PDFTronC.dll file is in the working directory. If it is not, I copy the file over from the Y Drive to the working directory. Upon completion or failure of the process I then delete this file to be safe.

A janky solution to meet the jankiness of UiPath.

string sourcePath = @"Y:\myFolderDirectory\PDFNetC.dll";

string destinationPath = Path.Combine(Environment.CurrentDirectory, "PDFNetC.dll");

if (!File.Exists(destinationPath))
{
    File.Copy(sourcePath, destinationPath);
}
1 Like

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