Microsoft.SqlServer.Management.Smo Namespace - what do I need to install to resolve it?

Mark Robinson picture Mark Robinson · Jan 20, 2011 · Viewed 13.9k times · Source

I'm picking up a support call on a legacy piece of software. It has the following imports:

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

The references in the project point to:

Microsoft.SqlServer.ConnectionInfo
Microsoft.SqlServer.Smo

.. which are not currently being resolved and causing the compile to fail.

What do I need to download and install to get this project to compile? I do currently have SQL Server 2008 installed. I've found links such as http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=50b97994-8453-4998-8226-fa42ec403d17 but I'm not sure what to install.

A link to what is required would be much appreciated! Thanks.

Answer

Damien_The_Unbeliever picture Damien_The_Unbeliever · Jan 20, 2011

You'd want to install the Management objects, which live in the XMO package:

The Management Objects Collection package includes several key elements of the SQL Server 2005 management API, including Analysis Management Objects (AMO), Replication Management Objects (RMO), and SQL Server Management Objects (SMO). Developers and DBAs can use these components to programmatically manage SQL Server 2005.

Note: Microsoft SQL Server 2005 Management Objects Collection requires Microsoft Core XML Services (MSXML) 6.0 and Microsoft SQL Server Native Client, also available on this page.

Audience(s): Customer, Partner, Developer

X86 Package (SQLServer2005_XMO.msi) - 9529 KB X64 Package (SQLServer2005_XMO_x64.msi) - 14963 KB IA64 Package (SQLServer2005_XMO_ia64.msi) - 18372 KB

But if you've already got SQL Server 2008 installed, you might have the equivalent assemblies already installed. They can be found under C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies.

I'm not sure how different the 2008 and 2005 versions are, and you probably want to ensure you don't recompile for 2008 if they're meant to be for 2005 or vice versa (although the 2008 SMO objects should let you manage 2005 server instances)