Using SMO with SQL Express
SMO is the new management model for SQL Server 2005, its included for use with SQL Express.
Because SMO is put into the GAC adding a reference to it requires some extra work.
As with all of the new Managed APIs provided for use with SQL Server 2005 that are GAC'd, we also put a copy of the assemblies for SMO into an SDK directory. This can be browsed to when adding references in Visual Studio to make developing apps easy. On my machine the SDK directory is: C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies.
Unfortunately there is a an issue with the SQLExpress Preview and Beta2 Editions, where the SDK dir is not put down on disk, this does not apply to the Developer Edition SKU and will be fixed for Beta 3 but it does mean that adding a reference to SMO (and the other assemblies in the directory) is difficult.
There are basically 2 workarounds for this, Jasper Smith, one of the SQL Server MVPs has done a great job of documenting one of the methods here:
https://www.sqldbatips.com/showarticle.asp?ID=35
The other way to do this, is to copy each of the files out of the GAC into your own SDK directory, using a batch file as its possible to cd into the GAC directories from a cmd prompt.
Incidentally Jasper has a great article on using SMO from VS here https://www.sqldbatips.com/showarticle.asp?ID=34 and has been working on an expressmaint utility as well, you can find part 1 here: https://www.sqldbatips.com/showarticle.asp?ID=27
Euan Garden
Product Unit Manager
SQL Server Tools