Installing the MySQL ADO.NET Connector into the Global Assembly Cache

This morning I sat through a MySQL webinar on Visual Studio tools for MySQL presented by the most excellent Reggie Burnett.

One of the questions that came up after the talk pertained to installation problems on Windows. (I should preface all this by saying that MySQL, the database server, has a good installer and is a snap to get running on Windows.)

I don’t usually use MySQL’s pre-compiled installers on Windows — now that I sorta know what I’m doing, I find it’s usually faster to set up MySQL and its attendant GUI tools without installers. And MySQL supports the notion of downloadable zips without binary installer cruft, which I really like, particularly in situations where you just need to yank one file out of the distribution (like documentation) without having to go through a whole big install.

But for those of us who eschew installers, there’s a trick with the MySQL tools for Visual Studio: the installer for the Visual Studio add-in apparently expects to find the MySQL ADO.NET provider (which MySQL refers to as "Connector/Net") in the Global Assembly Cache. If it doesn’t find the provider in the GAC, the add-in won’t run.

I was dimly aware of the existence of the GAC but I’d never needed to do anything with it myself in the real world (aside from mentioning it in my books). This isn’t a huge inconvenience, though. First you just need to locate a command-line utility called gacutil.exe on your machine (mine’s in the SDK directory under Visual Studio 8, but yours might be somewhere different depending on what tools you’re using).

Next you’ll need to locate MySql.Data.dll on your machine. This file can be located anywhere if you’re difficult like me and you don’t use an installer.

So, the entire command line I needed to use to install the MySQL provider in the GAC was:

"C:Program FilesMicrosoft Visual Studio 8SDKv2.0Bingacutil.exe" /i "C:Program FilesMySQLConnector.NET 5.0.3Driverbinnet-2.0releaseMySql.Data.dll"

(The /i switch means "install".)

This is certainly not brain surgery but hopefully putting all this in writing will save others some time.