Bug #102670 MySQL.data adds lots of System files dependencies to a VB.NET project setup
Submitted: 20 Feb 2021 11:41 Modified: 22 Feb 2021 16:53
Reporter: Philippe Lévi Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:8.0.21 and 8.0.22 at least OS:Windows (Win 10 v20H2)
Assigned to: MySQL Verification Team CPU Architecture:Any (x64)
Tags: Connector .NET, dependencies, setup, VB.NET

[20 Feb 2021 11:41] Philippe Lévi
Description:
Having found this issue in a much larger project I developed, I created a simple program using 8.0.22 connector.NET using Visual Studio 2019 COmmunity Edition (v16.8.5), dotnet v.4.8.04084 and VB.NET.

The program basically just tests the connection to my local MySQL database and closes.

I then created a Setup project using Microsoft Setup installer and when creating this project, adding the project output to the setup project generates 139 dependencies, out of which more than 130 are System assemblies, not needed when packaging the setup. 

I hold the complete package for you if need be as I can't seem to be able to attach it here.

How to repeat:
- Created a Windows Form-based .NET Framework VB project in VS209
- Added a reference to MySQL.Data dll (8.0.21 or 22 and maybe previous versions)
- Added the following code to the Form1 object created (change user and password):

Imports MySql.Data.MySqlClient
Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
        Dim conStr As String = "server=127.0.0.1;port=3306;database=mydatabase;user id=myuser;password=mypassword;sslmode=None"
        Dim conn As New MySqlConnection(conStr)
        
        If conn.State <> ConnectionState.Open Then
            conn.ConnectionString = conStr
            conn.Open()
            Threading.Thread.Sleep(1000)
            conn.Close()
        End If
    End Sub
End Class
[20 Feb 2021 11:47] Philippe Lévi
Uploaded the project file
[22 Feb 2021 16:30] Daniel Valdez
Hi Philippe, 

So reviewing your project, I can notice what you're mentioning regarding the 100+ dependencies added but as you can see, the MySql.Data has a direct dependency (natively added) to Microsoft .NET Framework which at the same time add more dependecies than we have. I also have tested this behaviour using other libraries and looks the same. So the issue is not our library itself. Maybe you could add a condition to not include these dependencies until installation time.

Thanks,
Daniel
[22 Feb 2021 16:47] Philippe Lévi
Hi Daniel,

Thx for the reply.
That's what I figured and I obviously did exclude these dependencies from the package setup. As I said, it' not a big deal...It just is a bit painful to exclude again all these at build time because, surprisingly, if you exclude all unwanted dlls in the project, each time you rebuild, some of them like System.Tracing and others get included ahain...

Thanks for looking into this stuff anyway...

Cheers from Paris, France

Philippe
[22 Feb 2021 16:52] Daniel Valdez
Hi Philippe, 

No problem! We would really like to be able to do something to help you but it's not in our side. Thanks for contacting us and don't hesitate to do the same in the future as this improves our product.

Cheers back from Mexico!
Daniel