Jump to content
RAGE Multiplayer Community

[SOLVED][C#] Could not load file or assembly System.Security.Permissions, System.Drawing.Common


Recommended Posts

 

Hi, i am new to C# and rage development, i was trying to follow MySQL tutorial by Outwardly Experience but after starting server i get these warnings:

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.
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 tried installing System.Security.Permissions in NuGet manager but that did not work, i also tried copying .dlls to runtime folder, still same errors.

My dependencies:

spacer.png

Any help would be great

Tutorial link:

https://www.youtube.com/watch?v=1QBj-DO6APM

 

Edited by Kopra
issue solved
Link to post
Share on other sites

I already tried that, still same errors.

spacer.png

Here are some more info:

I get these warnings when i try to execute my MySQL function in Main.cs ResourceStart public:

MySQL.MySQL.InitConnection();

MySQL.cs :

using System;
using System.IO;
using System.Reflection;
using MySql.Data.MySqlClient;
using GTANetworkAPI;


namespace Project.MySQL
{
    class MySQL
    {
        public static bool IsConnectionSetUp = false;
        public static MySqlConnection conn;

        public String Host { get; set; }

        public String Username { get; set; }

        public String Password { get; set; }

        public String Database { get; set; }

        public MySQL()
        {
            this.Host = "localhost";
            this.Username = "root";
            this.Password = "root";
            this.Database = "test_db";
        }

        public static void InitConnection()
        {
            String FilePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "SQLInfo.json");
            MySQL sql = new MySQL();

            if(File.Exists(FilePath))
            {
                NAPI.Util.ConsoleOutput("File found! Loading data....");
                String SQLData = File.ReadAllText(FilePath);
                sql = NAPI.Util.FromJson<MySQL>(SQLData);
                NAPI.Util.ConsoleOutput(SQLData.ToString());
                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());
                }
            }
            else // File not found
            {
                NAPI.Util.ConsoleOutput("File not found! Creating default data file....");
                String SQLData = NAPI.Util.ToJson(sql);
                using (StreamWriter writer = new StreamWriter(FilePath))
                {
                    writer.WriteLine(SQLData);
                }
                NAPI.Util.ConsoleOutput("File has been created. Loading data....");
                InitConnection();
            }
        }
    }
}

 

Edited by Kopra
Link to post
Share on other sites

Anyone? I tried everything there is on google...

Here is my .csproj file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="gtanetwork.api" Version="1.1.0-DP1-2" />
    <PackageReference Include="MySql.Data" Version="8.0.22" />
    <PackageReference Include="RAGEMP-Bootstrapper" Version="1.1.3" />
    <PackageReference Include="System.Drawing.Common" Version="4.7.0" />
    <PackageReference Include="System.Drawing.Primitives" Version="4.3.0" />
  </ItemGroup>

</Project>

 

Link to post
Share on other sites
  • Kopra changed the title to [SOLVED][C#] Could not load file or assembly System.Security.Permissions, System.Drawing.Common
  • Xabi locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...