Getting Error "Bad IL format. The format of the file 'C:\Users\Username\.nuget\packages\uipath.database.activities\1.7.1\lib/net5.0-windows7.0/runtimes/win-x64/native/Microsoft.Data.SqlClient.SNI.dll' is invalid" while publishing

Dear Forum Members,

I am working on an Automation Scenario where I am downloading files from a portal and then updating Database about the count of files being downloaded. Now, when I am trying to publish it to my local system to create a NUGET file, I am getting this error : “Bad IL format. The format of the file ‘C:\Users\Username.nuget\packages\UiPath.database.activities\1.7.1\lib/net5.0-windows7.0/runtimes/win-x64/native/Microsoft.Data.SqlClient.SNI.dll’ is invalid”.

Can anyone please help me in resolving this issue. Thanks in advance.

Thanks,
Dimple

Hi @dimple.khurana ,
Thanks for reaching out to UiPath Community.
Here are some steps I found which can solve the issue.

  • Delete the Microsoft.Data.SqlClient.SNI.dll file from the directory specified in the error message: C:\Users\Username.nuget\packages\UiPath.database.activities\1.7.1\lib/net5.0-windows7.0/runtimes/win-x64/native/.
  • Clear the NuGet cache by running the following command in the command prompt: nuget locals all -clear.
  • Re-install the UiPath.Database.Activities package by running the following command in the command prompt: nuget install UiPath.Database.Activities.
  • Build and publish the project again.

If you find this helpful, please mark it as a solution :writing_hand:

Regards,
@pratik.maskar

Hi @pratik.maskar ,

Thanks for your response.

I tried this but unable to clear the NuGet cache. Getting this:

Do you have any idea on this.

Thanks,
Dimple

Hi @dimple.khurana ,
Seems like it is partiaally cleared.
Can you try this , Open a command prompt as administrator and run the following command: nuget locals all -clear

Regards,
@pratik.maskar