ClickOnce and Bogus Required Assemblies

When I got by the ClickOnce issues described in my previous post and was able to install the prerequisites on the client, I thought I was home free.  You'd think that after almost twenty years of professional programming I'd have learned better by now...

After ClickOnce successfully installed the prerequisites and was starting to install my application, I got the following dialog saying that the "application requires that assembly ADODB Version 7.0.3300.0 be installed in the Global Assembly Cache (GAC) first":

ClickOnce ADODB Required

My first issue was that I couldn't figure out why ADODB was required.   The client application does no data manipulation, it simply accesses WCF services on a remote machine.   The ClickOnce installation was asking for it because it was specified as a prerequisite in the Application Files dialog on the Publish section of the project properties:

ClickOnce Publish Application Files Before

For some reason, Visual Studio decided the ADODB.dll was required.  I can't say I ever figured out why.   I saw some Google threads from people having the same issue who speculated it was the ReportViewer that triggered the requirement for ADODB.dll, but I never saw any authoritative information.

In the same Google threads, I saw there were two ways people dealt with this problem.  The first is to mark the file to be explicitly included, rather than being a prerequisite.  This causes the file to be deployed along with the application.  Other people explicitly marked the files to be excluded, which is what I did:

ClickOnce Publish Application Files After(Note that once a file is marked as excluded it only shows up in this list when the "Show All Files" control is checked.)   Excluding the file addressed the installation issue, and my application ran fine.   If something in my application actually requires ADODB.dll, I haven't found it yet.  I also excluded the SMDiagnostics.dll which was listed as a prerequisite for some reason.  The moral of the story is that in ClickOnce files sometimes show up as being prerequisites when they are not.  If you know they are not required for your application, marking them as excluded seems to be the best way to handle this.

3 comments: (+add yours?)

tomawesome said...

I feel your pain on this one! see my post: http://fingernailsontheblackboard.blogspot.com/2007/08/microsoft-clickonce-publishing-sucks.html

Anonymous said...

Cheers dude, this has saved me some time and aggro!

Anonymous said...

The exclude tricked worked for me. Similar situation - using ReportViewer, added as a prereq, on my newest Win7 box the app was deployed to I ran into this infuriating problem. Kudos Joe!