UiPath Robot cannot download package because access to the .Nuget config file is denied

System.UnauthorizedAccessException: Access to the path 'C:\Program Files\UiPath\Studio\Nuget.config' is denied.

Issue Description

The Robot starts running the job, but fails to download the package it needs for execution, because it does not have access to the Nuget.config file. This file directs the Robot to the package sources.

This error can be found under the YYYY-mm-dd_UiPath.Studio.log file:

[ERROR] [UiPath.Studio] [4] System.UnauthorizedAccessException: Access to the path 'C:\Program Files\UiPath\Studio\Nuget.config' is denied.
at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at UiPath.Studio.Shell.Migration.FeedMigrator.Apply(), HResult -2147024891

Root Cause

As the access to `C:\Program Files\UiPath\Studio\NuGet.config` file is restricted for the robot user, the robot can't reach the package sources defined in the `NuGet.config` file (located at `C:\Program Files\UiPath\Studio\NuGet.config`).

Resolution

Run as Administrator in a cmd.exe console the below command to fix the permission issue for the 'C:\Program Files\UiPath\Studio\Nuget.config' file:

icacls "C:\Program Files\UiPath\Studio\NuGet.config" /grant Everyone:F

Explanation of the command:

  • icacls: A built-in Windows command-line tool for modifying access control lists (ACLs).
  • "C:\Program Files\UiPath\Studio\NuGet.config": Replace this with the path to the file you want to modify.
  • /grant: Specifies that you're granting permissions.
  • Everyone:F: Grants full control (F) to the Everyone group.


Results of the command execution:

How to confirm the solution:

Re-run the UiPath Robot and it should download packages.