How do I Recompile the MySQL Library to Run Under the Medium Trust Environment?
Print this Article
Last Updated:
January 15, 2008 4:36 PM
We have configured the .NET 2.0 environment to run in a customized medium trust environment. The MySQL libraries must be modified to run under this environment. This article describes how to recompile the MySQL/Connector library to run under this version of medium trust.
- Download the source code for the MySQL Connector/Net from www.mysql.com.
- Extract the contents of the zip file to a local directory.
- Open mysql.csproj project file in Visual Studio.
- Open the AssemblyInfo.cs file, and add the following code, in the using block, at the top of the file (if it is not already there):
using System.Security;
- Add the following code to the assembly section of the file:
[assembly: AllowPartiallyTrustedCallers]
- Recompile the dll.
You may now reference this dll from other projects. When you decide to publish your project to your hosting server, you need to upload this modified version of the dll to your bin directory.