This example shows you how to build a simple C# SMO Console application using Visual Studio 2005. Follow these steps:
Select File New Project from the Visual Studio 2005 main menu.
In the New Project dialog box, select Visual C# as the project type and select Console Application from the installed templates.
Enter a name for the project and specify the location in which to save the project. Click OK.
Right-click References in the Solution Explorer window. Select Add Reference from the context menu.
In the Add Reference dialog box, add a reference to the Microsoft.SqlServer.ConnectionInfo.dll and Microsoft.SqlServer.Smo.dll assemblies.
Click OK to close the dialog box and add the references.
In the Solution Explorer window, right-click the file Program.cs. Select View Code from the context menu.
Expose SMO types by adding the following using directives to the code:
using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Common;
Add using directives for any other types that you need access to.