Jump to content
RAGE Multiplayer Community

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


Recommended Posts

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!");
        }

    }
}

 

Link to post
Share on other sites
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
Link to post
Share on other sites

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...