Compiler initialization failed unexpectedly when running the project from Agent/Orchestrator

Scenario: Getting the error : compiler initialization failed unexpectedly when running the project from Agent/Orchestrator.

The error occurs when the below code is executed inside InvokeCode activity.

ExtractDataTable.Rows(0).Item(0) = ASNReciept

But the same code works perfectly when ran from Studio,

Steps to reproduce: Execute the code in InvokeCOde activity and run from Agent/Orchestrator.

Current Behavior:

Expected Behavior: This code should execute without any break/exception.

Studio/Robot/Orchestrator Version:Studio CE-2018.2.3 and Orchestror version CE - 2018.4.2

Exception :
Error compiling code error BC2000: compiler initialization failed unexpectedly: Project already has a reference to assembly UiPath.Excel.Activities.Design.resources. A second reference to ‘C:\Users\maria.admin.nuget\packages\uipath.excel.activities\2.4.6884.25683\lib\net452\fr\UiPath.Excel.Activities.Design.resources.dll’ cannot be added. At line -27
Invoke code
System.ArgumentException: Error compiling code error BC2000: compiler initialization failed unexpectedly: Project already has a reference to assembly UiPath.Excel.Activities.Design.resources. A second reference to ‘C:\Users\maria.admin.nuget\packages\uipath.excel.activities\2.4.6884.25683\lib\net452\fr\UiPath.Excel.Activities.Design.resources.dll’ cannot be added. At line -27
at UiPath.Core.Activities.InvokeWorkflowFile.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Hi @maria.josephina

The types of issue where process runs from Studio but not from Orchestrator are often solved by clearing these two folders and restarting your process:

%userprofile%\.nuget\packages
%userprofile%\AppData\Local\UiPath\.cache

Also, see here for more context: