Could Not Load File Or Assembly ClosedXML - KB

Studio / Robot project fails to run because of error "Could not load file or assembly ClosedXML".

The ClosedXML is a sub-dependency used by various UiPath dependency packages. If a dependency package uses ClosedXML as a sub-dependency, it will be listed in the information panel of the activity or when the dependency is expanded in the Studio project panel.
closedXML1.PNG
closedXML_2.PNG

The error "Could not load file or assembly 'ClosedXML'" is often caused by the sub-dependency not being resolved or by having multiple dependency packages that use ClosedXML as a sub-dependency and their versions being different.

In order to solve this, follow the below approaches:

Approach #1:
  1. Navigate to the location " %Userprofile% /.nuget/packages". Find the "closedxml" folder and open it. Inside the folder, you should have other folders, one for each package version, like in the example below.
closedxml_folders.PNG
  1. If there are no versioned folders, it means that the Robot could not download this package from the source. This can be either caused by networking restrictions, network failures or product malfunctions.
  2. A quick solution for this is to copy the folder closedxml from the .nuget\packages location of another Robot or from a computer where Studio is installed and projects are developed.
  1. For a networking-related approach, see the recommendations from the page Services the Robot connects to.
  2. If ClosedXml is resolved and used as a sub-dependency by multiple packages in your project and it has different versions, upgrade or downgrade either of the package dependencies so that at the end, you have the same version of ClosedXml inside all the dependencies.

Approach #2:
  1. Close UiPath Studio. Navigate to the location " %Userprofile% /.nuget/packages". Find the "closedxml" folder and either rename it, or delete it.
  2. Open UiPath Studio and open the project. This will force the nuget agent to re-create the ClosedXML folder.


Approach #3:


This approach involves re-creating the entire .nuget/packages folder (not just the "closedxml" folder). The steps on how to do this are explained in this article at "Approach #2" - Could not load file or assembly .