I need to use Server class which is stored in Microsoft.SqlServer.Smo.dll
I don't see this assembly in usual References dialog. I have found it at C:/Program Files/Microsoft SQL Server/100/SDK/Assemblies
and try to reference from there but Visual Studio throws an error
A reference 'C:/Program Files/Microsoft SQL Server/100/SDK/Assemblies/Microsoft.SqlServer.Smo.dll' could not be added. Please make sure that file is accessible, and that it is a valid assembly or COM component.
What am I doing wrong?
C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies is the correct folder location.
You need to add references to:
Microsoft.SqlServer.ConnectionInfo.dll
Microsoft.SqlServer.Smo.dll
Microsoft.SqlServer.Management.Sdk.Sfc.dll
Microsoft.SqlServer.SqlEnum.dll
(These are the minimum files that are required to build an SMO application)
Ref.: How to: Create a Visual C# SMO Project in Visual Studio .NET