Link to home
Create AccountLog in
Avatar of ChrisMDrew
ChrisMDrew

asked on

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?
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of ChrisMDrew
ChrisMDrew

ASKER

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...
Found another registry key which did work!  Also checked for the DLL in the appropriate fold4er for safety