0

I am using Visual Studio Code and trying to write a script for GTA 5 RAGEMP using C#, im fairly new to C# and it was all going good untill i tried to create MySQL connector using MySQL.Data from oracle. On my try - catch i get this:

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.'
                String SQLConnection = $"SERVER={sql.Host};PASSWORD={sql.Password};UID={sql.Username};DATABASE={sql.Database}";
                conn = new MySqlConnection(SQLConnection);

                try
                {
                    conn.Open();
                    NAPI.Util.ConsoleOutput("MySQL connection is up!");
                    IsConnectionSetUp = true;

                }
                catch(Exception ex)
                {
                    NAPI.Util.ConsoleOutput(ex.ToString());
                }

I get this in server console output:

Could not load file or assembly 'System.Security.Permissions, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
Could not load file or assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
Could not load file or assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
Could not load file or assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
Could not load file or assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

And this in VSC console output:

Exception thrown: 'System.IO.FileNotFoundException' in MySql.Data.dll
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.dll
An exception of type 'System.IO.FileNotFoundException' occurred in System.Private.CoreLib.dll but was not handled in user code
Could not load file or assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

I copied everything from MySQL/Connector to my runtime folder, i tried using NuGet to download System.Drawing.Common and System.Security.Permissions, i tried adding .DLLs manually to project dependecies, nothing worked.

0

1 Answer 1

1

I'm guessing RAGEMP embeds some version of the .NET Runtime that doesn't include those assemblies by default.

Try using nuget.org/packages/MySqlConnector instead. It also supports connecting to MySQL from C# but has fewer dependencies.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.