System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Data.SqlClient
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Data.SqlClient=5.0.0.0 even when i use 5.2.2
So, i create a little web-api (.net 8) which only will be available to other services on the published server.
When it's finished it should access some db-tables and create excel-files out of them - depending on request params.
It's really simple, it only requires ClosedXML (not yet added) & Microsoft.Data.SqlClient
Locally all works fine, but when publishing project, i get this error (see above).
I tried everything from self-contained, updating .net runtime, stackoverflow tips, ... but nothing worked
Switched also to SqlClient 6.0.0-preview, still says 5.0.0.0 is missing.
4 Replies
Additionally .csproj file:
Switched also to SqlClient 6.0.0-preview, still says 5.0.0.0 is missing.The fact that it's looking for
5.0.0.0
across two version spec changes on your part indicates that something here is referencing a lower version; and it won't respect the higher version as a result. I recommend digging through the dependency chain (to include the import you have) and locate what's referencing the lower version.
I don't have enough time to dig much deeper than that right now, but hopefully that helps.Try $vsdrunk @simon
* close VS
* remove the hidden folder
.vs
* remove all bin
and obj
folder next to each csproj (DO NOT TOUCH THE .git
FOLDER OR WHAT'S INSIDE)
* restart vs