How to solve "Bad IL format. The format of the file 'C:\Users\username\.nuget\packages\uipath.database.activities\1.7.0\lib/net5.0-windows7.0/runtimes/win-x64/native/Microsoft.Data.SqlClient.SNI.dll' is invalid"?
Issue Description: The error "Bad IL format. The format of the file 'C:\Users\username\.nuget\packages\uipath.database.activities\1.7.0\lib/net5.0-windows7.0/runtimes/win-x64/native/Microsoft.Data.SqlClient.SNI.dll' is invalid" appears in Studio when compiling or publishing a new Windows project or a Windows project converted from a Windows-Legacy project.
Resolution:
Approach #1: This is a known issue in the UiPath.Database.Activities package version 1.7.0 (also observed with 1.7.1) as presented in the package Release Notes.
- Go to the database activity properties and update the Provider Name from System.Data.SqlClient to Microsoft.Data.SqlClient as shown below:
Note: For Windows - Legacy projects, choose between System.Data.SqlClient or Microsoft.Data.SqlClient.
Approach #2: Follow the steps below,
- Delete the Microsoft.Data.SqlClient.SNI.dll file from the directory mentioned in the error message.
- Reinstall the UiPath.Database.Activities package via Studio - Manage Packages.
- Try running the automation again and see if the error is resolved.