C# Detect if SMO is installed on a client PC

I have an application which uses SQL Server Management Objects which is installed onto client PCs.  I need to know whether or not SMO is installed on the PC and if not to install it.  I thought that code of

try
{
  Server server = new Server(connection);
}
catch (Exception)
{
  // SMO not installed so install
  ...
}

would work but the exception is not caught even if SMO is not installed - I only get an exception when I try and use the object which is a bit late really  Is there a way in .NET 3.5 to determine whether or not the SMO Dlls are installed?
ChrisMDrewAsked:
Who is Participating?
 
Carl TawnConnect With a Mentor Systems and Integration DeveloperCommented:
The most reliable way is probably going to be to check the registry.

The sample posted here should point you in the right direction:

    http://stackoverflow.com/questions/42438/whats-the-best-way-to-detect-the-presence-of-smo
0
 
ChrisMDrewAuthor Commented:
Hi - yes I've seen that post however it doesn't seem to work for me as I don't have that registry key yet do have SMO 2008 installed...
0
 
ChrisMDrewAuthor Commented:
Found another registry key which did work!  Also checked for the DLL in the appropriate fold4er for safety
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.