KB PS Package cannot be installed it depends on UiPath Activities Api - rpapub/WatchfulAnvil GitHub Wiki
- 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'”
The .csproj
contained:
<PackageReference Include="UiPath.Activities.Api" Version="24.10.1" />
As a result, dotnet pack
added this dependency to the .nuspec
file 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.
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.
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>
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>
Use a script in GitHub Actions or local pre-build to avoid checking UiPath DLLs into source control.
- Build
.nupkg
usingdotnet pack
- Open with 7-Zip, extract
.nuspec
- Remove
<dependencies>
referencingUiPath.Activities.Api
- Important: Leave empty
<group>
entries per TFM:
<dependencies>
<group targetFramework=".NETFramework4.6.1" />
<group targetFramework="net6.0" />
<group targetFramework="net8.0" />
</dependencies>
- Save
.nuspec
back into.nupkg
- ❌
"This package is not compatible with Windows projects"
- Caused by Studio using a cached
.nupkg
from previous builds
- Delete local NuGet cache:
~/.nuget/packages/<package-name>
- Replace
.nupkg
in the Studio feed directory