When my exe is on a client machine, I want to see if a reference in the program is valid. Mine happens to be for SMO, but it could be anything. In my project, I've added the necessary dll references. My code is follows...
Private Function DoesSMOExist() As Boolean
Dim oServer As New Server() ' See if SMO dlls are even present on the machine.
Catch ex As Exception
I want my Try-Catch to return true or false, based on if a new object to this particular reference can be created. Instead, I get an unhandled exception that pops up a message, which I definitely want to avoid showing the users. The text is as follows...
ption: Could not load file or assembly Microsoft.SqlServer.Smo, Version 10.0.0.0...
Anyway, I don't need this to only work for this particular reference/object, but I want to know how to do it for *any* reference/object to determine if a client machine can handle it. I don't want to put the dlls on the client machine, nor do I want to search the registry (could be multiple places), nor do I want to see if a certain dll is in a certain location (could be multiple places).
I only want to detect if a given machine can reference (and create) a given DLL reference without popping up an ugly message.
Anyone know how to do it? Or can't it be done?