Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to deploy mySqlConnector with my application #1478

Open
paulisidore opened this issue May 4, 2024 · 5 comments
Open

Unable to deploy mySqlConnector with my application #1478

paulisidore opened this issue May 4, 2024 · 5 comments

Comments

@paulisidore
Copy link

HI,
for 2 weeks I have been trying to move from MySql.Data to MySqlConnector for .NET, the program works correctly on the development machine (Visual Studio 2022) but once deployed it does not work and I receive this exception:

Unable to load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The specified file can not be found.

Development OS: Windows 10 Pro 22H2
Deployment OS: Windows 10 Pro 22H2 and 1607
MariaDB Server 10.5.13

The System.Runtime.CompilerServices.Unsafe file is present in the application folder on all machines.
Also, the same application using mysql.data works correctly on all computers.

I also deleted MySql.Data.dll from the application folder but I still got the same result.

I also changed the version of my MariaDB Server to version 10.11 but no results while version 10.5.13 works without problems on my development computer.

Please, could you help me?

@tcsaddul
Copy link

tcsaddul commented May 4, 2024

You need to "nuget" System.Runtime.CompilerServices.Unsafe

Make sure to copy the .dll where your app is deployed.

@paulisidore
Copy link
Author

Hello @tcsaddul and thank you for your answer.
I have already installed this Nuget and I mentioned it in my previous post. I also checked that it is deployed in the application folder. I think it's a nuget dependency that I don't know about...

@tcsaddul
Copy link

tcsaddul commented May 4, 2024

Make sure that your application has the privilege (manifest) to access the folder and the version of the .dll is the same. Also make sure the declaration in the exe.config are the same version or remove the line.

@bgrainger
Copy link
Member

Sounds like a binding redirect issue; see my answer (for a different assembly) here (and follow similar steps): #1139 (comment).

@paulisidore
Copy link
Author

@tcsaddul ,
The application has acces to the folder since when I return to MySQL.Data.Dll the application works without problems on all workstations. For the version of the dlls, I am thinking of using the "Binding Redirect" option, I have no way of checking the ideal versions except to look at the NuGet package manager. Besides, is there a way to check the version of the assembly loaded by the application to find incompatibilities?

Hello @bgrainger and thank you for your messages, I will try the Binding Redirect option on Mondays and will get back as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants