views:

253

answers:

2

I have a winform solution that I deploy through clickOnce. There is the Main Project and then a Project called psWinForms. That project has a Reference to Microsoft.ExceptionMessageBox that I use in my custom error reporting.

I have psWinForms as a reference in my Main Project with Copy Local = True.

I have Microsoft.ExceptionMessageBox as a reference in psWinForms with Copy Local = False & Specific Version = False

In Application Files I have Publish Status =Prerequisite(Auto)

I have tried various combinations to no avail.

I looked here on the Test System on the DLL is there.

C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies

I am using the ExceptionMessageBox from SQL version 9.0.242.0 if that makes a difference and the users only have SQL 2005 Express(9.0.1399.0) installed.

So I am very confused as to why my app hangs when I try to throw an error using this....

+2  A: 

You can't copy and deploy the assembly yourself, it has to be installed as part of the SQL client components. There are different client components for SQL 2008 and SQL 2005, your application has to reference the proper one. So you'll have to ship two different applications, one compiled for SQL 2005 and one for SQL 2008 and your users will have to install the proper one. From Deploying an Exception Message Box Application:

The exception message box is installed by Microsoft SQL Server and is supported for use in your custom Windows applications to improve exception handling. Because the exception message box is installed by all editions of SQL Server except SQL Server Compact 3.5 SP1, you can use it with no additional configuration on any computer on which SQL Server client components, including the SDK, have been installed.

While technically is probably possible to deploy the assembly and add it to the GAC yourself is a bad practice as your dll will not be part of the normal chain of service packs and cummulative upgrade patches.

Also you better clear up with an MS representative whether deploying this dll standalone is OK with the SQL client usage license or not. Every component that can be redistributed under the license has an install msi available for developers to distribute. If this dll does not is a strong indicator that is not allowed to be redistributed by 3rd parties (you).

Update

There is actually a distributable msi (SQLServer2005_EMB.msi, SQLServer2005_EMB_x64.msi) for the ExceptionMessageBox component:

In SQL Server 2005 SP1 and later releases, the exception message box is also provided as a redistributable installation program that you can distribute and deploy with your application... The redistributable installation program for exception message box is available online as part of the Feature Pack for SQL Server 2005 SP1.

Remus Rusanu
Okay, that mostly makes sense. If SQL is installed on each system how do I get it to use the one installed?
Refracted Paladin
You can use reflection and load the current assembly dynamically (which is a pain for you as a developer). You can have two different applications and the user has to install the right one (which is a pain for your users). Last option is to use an Assembly Redirect in your .config file that redirects the assembly you compiled with to whatever is installed on the customer machine: http://msdn.microsoft.com/en-us/library/7wd6ex19(VS.80).aspx
Remus Rusanu
I think I am confused. ALL users have only SQL 2005 Express installed which has version 9 of the `Exception.MessageBox` If that is installed on each system can't I somehow just reference that?
Refracted Paladin
Yes, build you application by referencing v9 of `Exception.MessageBox` in your VS project references.
Remus Rusanu
That is what I was afraid of. I did that and it still asks for version 10. Even if I `copy local`.... Now what, I wonder?
Refracted Paladin
You don't need to copy local or anything. Exception.MessageBox should not be part of your project. You should go to References and add a reference, in the .Net panel select the Component named ExceptionMessageBox with version 9. Make sure you have no references to v10 anywhere in your solution (other projects) then rebuild the whole solution.
Remus Rusanu
+1  A: 

do you have the assembly referenced in your MAIN application? I didn't see that scenario listed...I have found that for copy local to work, you need to have all sub-projects references in the main application reference list otherwise you get unpredictable results. Also if you need your specific file to be used, make sure use specific version is true.

the same goes for App.config sections...if you have project level appconfigs you have to merge that with the application level app.config.

ecathell