ClickOnce and the Global Assembly Cache...

I am starting to use ClickOnce,  but I am running into a problem.  I get an error on the prerequitites stating that Microsoft.SqlServer.ConnectionInfo is not in the Global Assembly Cache (GAC) and that it needs to be there before the application can be deployed.  There seems to be no redistributable for the SMO assemblies.  Regardless, how can I install assemblies to the GAC using ClickOnce.  Rightnow, the SMO assemblies are listed by default as Prerequisite (Auto) in the Application Files section of the Publish tab in the Settings dialog.  Should this be set to include?  Though I assume that if it is set to include the assemblies will be added to the application's installation directory rather than to the GAC and that not the ideal here.
Who is Participating?
Yes it would, unless you took extra steps to change the ClickOnce Uninstall Package.

The best practices answer is that if you need to add things to the GAC, either add a custom install package as a prerequisite, use a separate Install Project, or use MSI/InstallShield.
Change them from Prerequisite to Include.
This won't install them in the GAC, but will copy them to the application directory, which will work.
If you want to add them to the GAC, have your application do this on startup.
thrillingryanAuthor Commented:
I'm wondering if there is a best practice for this.  Seems like it would be a pretty common problem. RobertRFreeman, have you written any code you can share to add such assemblies to the GAC?  What about the uninstallation procedure?  Is that a worthy consideration?  Once I install the assemblies via my application, if the user uninstalls my application it will leave the assemblies in the GAC, right?

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.