BlueBarren BlueBarren - 3 months ago 69
C# Question

Finding Microsoft.SqlServer.Management.Smo and ConnectionInfo References that are Compatible

I'm trying to use

using Microsoft.SqlServer.Management.Common
using Microsoft.SqlServer.Management.Smo


And I successfully found the .dll files on my C: drive in the usual place,

C:\Program Files\Microsoft SQL Server\


The problem is that apparently the two aren't compatible.

.Smo
comes from
\130\SDK\Assemblies

and

.Common
comes from referencing the
.ConnectionInfo.dll
from
\110\SDK\Assemblies


so I wonder since they're not in the same
\number\SDK\Assemblies
that's why they aren't the same version. When I run the application I get this message from Visual Studio


"Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed."


And


"Assembly 'Microsoft.SqlServer.Smo, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' uses 'Microsoft.SqlServer.ConnectionInfo, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' which has a higher version than referenced assembly 'Microsoft.SqlServer.ConnectionInfo, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'"


I tried to do what Microsoft suggest which is set AutoGenerateBindingRedirects to true but that did not work.

ASK:

Where would I go to find the proper versions of the dlls?

sly sly
Answer

I can see both dlls in the same directory on my SQL Server installation:

c:\Program Files\Microsoft SQL Server\110\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll
c:\Program Files\Microsoft SQL Server\110\SDK\Assemblies\Microsoft.SqlServer.Smo.dll

Using VS 2015 with .net 4.5.2 I'm able to reference both dlls, build, and run a console app that uses the ServerConnection and Server classes.

See if you can find the Microsoft.SqlServer.ConnectionInfo.dll in the 110\SDK folder.