Jump to content

System.TypeLoadException: 'Could not load type 'GTANetworkAPI.Client' from assembly 'Bootstrapper, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null'.'


Recommended Posts

Posted

Hello, my simple C# code cant compile

 

Break "System.TypeLoadException: 'Could not load type 'GTANetworkAPI.Client' from assembly 'Bootstrapper, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null'.'"

 

Code

using System;
using GTANetworkAPI;

namespace Server
{
    public class Main : Script
    {
        [ServerEvent(Event.ResourceStart)]
        public void OnResourceStart()
        {
            NAPI.Util.ConsoleOutput("Server started");
        }

        [ServerEvent(Event.PlayerConnected)]
        public void OnPlayerConnected(Client player)
        {
            //NAPI.Util.ConsoleOutput($"{Player.Name} has connected");
            player.SendChatMessage("Welcome to our server!");
        }

    }
}

 

Posted (edited)

 

My code didnt compile with "Player" variable, until I changed Visual Studio project properties

I uninstall nuget GTANetworkAPI package and make Reference to Bootstrapper.dll from server-files/dotnet/runtime

I change Project Settings:

  • Target Framework .Net Core 3.1
  • Platform Target x64

And now, when I connecting to the server I got same error in Server console

Could not load type 'GTANetworkAPI.Client' from assembly 'Bootstrap

My code right now

using System;
using GTANetworkAPI;

namespace GTAServer
{
    public class Main : Script
    {
        [ServerEvent(Event.ResourceStart)]
        public void OnResourceStart()
        {
            NAPI.Util.ConsoleOutput("Resource started");
        }

        [ServerEvent(Event.PlayerConnected)]
        public void OnPlayerConnected(Player player)
        {
            NAPI.Util.ConsoleOutput($"{Player.Name} has connected");
            player.SendChatMessage("Welcome to our server!");
        }

    }
}

 

Edited by hitmany
  • Like 1
Posted

I am sorry, my bad.

I forgot to update meta.xml, because net core updated and I didnt change core2.0 folder to core3.1

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...