Solved

C# Detect if SMO is installed on a client PC

Posted on 2010-11-08
3
816 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now