Open shandysawyer opened 2 years ago
Microsoft.Data.SqlClient
has a dependency on 4.22 while the SMO nuget package defines a dependency on 4.35. To resolve the mismatch you need to configure a binding redirect of some sort, whether through an app.config
for your test DLL or by writing an assembly resolver in your test code.
The SMO tests have assembly resolvers in code for Newtonsoft conflicts like https://github.com/microsoft/sqlmanagementobjects/blob/98093604e9ede97aa2a9b066279f0bd9d9557c4f/src/UnitTest/Notebook/SmoNotebookTests.cs#L30
That code could really load any assembly just by picking up whatever DLL with that name is in the same folder with the test.
I have a .NET 4.8 framework Windows application that is using Microsoft.SqlServer.SqlManagementObjects (v161.47027.0) in its own class. I am unit testing that class in a separate .NET 4.8 library test project.
However when I run a test like so:
It is throwing an error around this bit of code in my service class:
Error:
Two reasons this is odd: