Microsoft.ExceptionMessageBox not being “found”

2019-02-19 14:55发布

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条回答
2楼-- · 2019-02-19 15:10

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.

查看更多
Emotional °昔
3楼-- · 2019-02-19 15:23

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.

查看更多
登录 后发表回答