Bad IL Request after Windows-Legacy to Windows Conversion

I have been receiving this error after I converted my project from Windows-Legacy to Windows Version:

Bad IL format. The format of the file ‘C:\Users<username>.nuget\global\UiPath.database.activities\1.7.1\lib/net5.0-windows7.0/runtimes/win-x64/native/Microsoft.Data.SqlClient.SNI.dll’ is invalid.

All of my packages are updated to their stable releases and downgrading the packages does not seem to help either as the same error will occur (just with a different version number).

Has anyone else had this problem? Could use a solution to this, thanks!

Did you install .NET Desktop Runtime 5.0.17 from here Download .NET 5.0 (Linux, macOS, and Windows) and restart the machine in the end?
What is your database provider in your automation?
Do you have the 64-bit driver of your database installed on your machine?
Did you recreate the Connection string from the beginning using the Connection wizard using the Connect to database activity?

There is a known issue as of v1.7.0 when converting from Windows - Legacy to Windows project.

Try to update the ProviderName from System.Data.SqlClient is changed to Microsoft.Data.SqlClient

I am getting the same error after changing from Legacy to Windows in my project.json file :frowning:

I have installed the 1.7.1 package and changed the providername to Microsoft.Data.Sqlclient as suggested.

When i check the file at the path the error message is refering to, it looks like the file there is version - could this be an issue?


I tried installing .NET Desktop Runtime 5.0.17 as Marian suggested and restarted my machine.

I connect using this: “Data;Initial Catalog=app_rpa;Persist Security Info=True;User ID=” + SQL_User + “;Password=” + new System.Net.NetworkCredential(string.Empty, SQL_Password).Password + “;Encrypt=False” where i pass in arguments.

I can run the file and write to my SQL database, but i get issues when i try to publish it as part of a library and use the activity in another project.