Whe building a .NET 4.0 application with MySQL .NET Connector 6.2.2, you may get an 0x80131515 error from the SGEN utility, saying that the operation is not supported.
Apparently Visual Studio 2010 does not like the fact that the MySQL DLLs are pulled from the global assembly cache (GAC). If you add file references to these MySQL DLLs in your project, everything works.
To remove MySQL .NET Connector 6.2.2 from the GAC, you have to uninstall it. That is right: you have to uninstall it to use it!
After you uninstall MySQL .NET Connector 6.2.2 from the control panel, you can unzip the MySQL .NET Connector 6.2.2 zip file that you download from MySQL, and then place the files at a location that you can reference from your project.
Add references to these files in your project by browsing to them, you can then build your project with .NET 4.0 without errors.