Custom Activities cannot be installed because it depends on package 'System.Activities'

Hi,

Anyone run into this issue while trying to install a custom activity?

My code is like this

using System;
using System.Activities;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;

public class MyAsyncActivity : AsyncCodeActivity
{

Don’t think I can go without the reference of System.Activities. But I never specify any version in the project file. Not sure why it stops the package from being installed.

Any help will be appreciated.

Thank you.

Hi,

Ensure that your custom activity project does not include a specific version of the System.Activities package that conflicts with the one in UiPath Studio. In your .csproj file, remove any direct dependencies on System.Activities. Instead, rely on UiPath’s built-in version by removing any explicit PackageReference to System.Activities. If you need System.Activities types in your code, simply include using System.Activities; in the code without adding it as a package dependency. Rebuild the project after making these changes, and try installing the custom activity again.

Regards,
Kardelen

Hello,

When referencing the System.Activities package use PrivateAssets=“All” like this:

<Reference Include="System.Activities.Metadata" Version="6.0.0-20220831.1" PrivateAssets="All"/>

Let me know if this works.

Thanks,
Adrian

1 Like

Hi @adrian.ignat Thank u. Tried but the error still remains.

Hi @kardelencihangir Thank u. Had followed your advice, did dotnet clean and build again. Problem remains. Pasting the complete csproj file below. (I tried both net6.0 and net8.0 for the target framework. Result same).

====

net6.0 enable enable true MyRpaCustomActivities 1.0.0 Wang Yu Custom Activites of my RPA Project ====


I’m using VS Code by the way.

Is it possible to post a sample project somewhere so I can look at it?

Hi @adrian.ignat pls see attached. Thank you.
project.zip (57.5 KB)