KB PS Package cannot be installed it depends on UiPath Activities Api - rpapub/WatchfulAnvil GitHub Wiki

Problem: Custom Workflow Analyzer NuGet Package Cannot Be Used in UiPath Studio

Symptoms

  • Attempting to install a custom CPRIMA.WorkflowAnalyzerRules.nupkg in UiPath Studio fails
  • Package appears in Manage Packages but displays:
    • ❌ “Package 'XYZ' cannot be installed because it depends on 'UiPath.Activities.Api'”

Root Cause

The .csproj contained:

<PackageReference Include="UiPath.Activities.Api" Version="24.10.1" />

As a result, dotnet pack added this dependency to the .nuspecfile inside the .nupkg, which Studio rejects.

UiPath Studio enforces rules that prevent certain internal packages like UiPath.Activities.Api from being installed via NuGet dependencies. Including UiPath.Activities.Api in a custom package’s dependency tree causes the Studio validation to reject the package.

Solution

✅ Recommended Fix – Clean Local Reference with PowerShell Preparation

Avoid any UiPath.Activities.Api dependency in the .nupkg. Instead, reference the required DLLs locally at compile time and exclude them from the final NuGet package.

1. Download UiPath.Activities.Api DLLs Locally

Create a PowerShell script (prepare-api-dlls.ps1) that:

  • Downloads specific UiPath.Activities.Api versions
  • Extracts the required DLLs per TFM (net461, net6.0, net8.0)
  • Outputs to: lib-deps/UiPath.Activities.Api/<TFM>

2. Update the .csproj

Replace <PackageReference> with direct <Reference> entries:

<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
    <PackageReference Include="UiPath.Activities.Api" Version="23.10.3">
        <ExcludeAssets>runtime</ExcludeAssets>
        <PrivateAssets>all</PrivateAssets>
    </PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
    <PackageReference Include="UiPath.Activities.Api" Version="24.10.1">
        <ExcludeAssets>runtime</ExcludeAssets>
        <PrivateAssets>all</PrivateAssets>
    </PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
    <PackageReference Include="UiPath.Activities.Api" Version="24.10.1">
        <ExcludeAssets>runtime</ExcludeAssets>
        <PrivateAssets>all</PrivateAssets>
    </PackageReference>
</ItemGroup>

3. Automate in CI

Use a script in GitHub Actions or local pre-build to avoid checking UiPath DLLs into source control.


🔄 Alternative Workaround – Manual .nuspec Edit via 7-Zip

Steps:

  1. Build .nupkg using dotnet pack
  2. Open with 7-Zip, extract .nuspec
  3. Remove <dependencies> referencing UiPath.Activities.Api
  4. Important: Leave empty <group> entries per TFM:
<dependencies>
  <group targetFramework=".NETFramework4.6.1" />
  <group targetFramework="net6.0" />
  <group targetFramework="net8.0" />
</dependencies>
  1. Save .nuspec back into .nupkg

Interim Issue:

  • "This package is not compatible with Windows projects"
  • Caused by Studio using a cached .nupkg from previous builds

Fix:

  • Delete local NuGet cache: ~/.nuget/packages/<package-name>
  • Replace .nupkg in the Studio feed directory

References

⚠️ **GitHub.com Fallback** ⚠️