Solved

C# Detect if SMO is installed on a client PC

Posted on 2010-11-08
3
831 Views
Last Modified: 2013-12-16
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?
0
Comment
Question by:ChrisMDrew
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 34086657
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
 

Author Comment

by:ChrisMDrew
ID: 34088337
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
 

Author Closing Comment

by:ChrisMDrew
ID: 34144276
Found another registry key which did work!  Also checked for the DLL in the appropriate fold4er for safety
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server Connection String through a VPN 8 55
Add a Condition in ASP Repeater 6 34
SSIS On fail action 5 38
jquery tab header text 1 23
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question