I’m writing a C# app in Visual Studio 2012, under .NET 4.0, and I am trying to package the MySQL.Data DLL with my deployable ( I believe that this is the right path).
Here is my situation:
- I have a Click Once application that references a DLL that one of my other projects yields.
- The DLL in reference uses MySQL.Data.MySqlClient.
- MySql.Data.MySqlClient does not come with a .NET package, but must be installed with MySQLConnector.NET
Can I bundle the MySql.Data.dll file with my click once application, and reference IT, rather than the one that came with the connector?
So more specifically; how can I ensure that the DLL goes out with my ClickOnce, and how can I ensure that I make a relative link to that DLL?
To add an assembly to your ClickOnce deployment, there are two cases.
1: You have a direct reference to the assembly.
Add the assembly to the main project.
Set the build action to ‘none’.
Set ‘copy to output directory’ to ‘do not copy’.
Add a reference to whatever project accesses that assembly. Browse to the dll you added to your project and select it. Set ‘copy local’ to true.
2.You do not have a direct reference to the assembly.
Add the assembly to the main project.
Set the build action to ‘none’.
Set ‘copy to output directory’ to ‘copy always’.
Some assemblies can be deployed locally (SQLCE, for example) and some can not (SQL Server Express, for example). You can try it and see.
You do have to take into account the licensing, and whether they allow you to include the dll instead of installing the package as a prerequisite. Some companies do not allow you to deploy their products willy-nilly. (That’s a technical term.)