hitmany Posted May 5, 2020 Posted May 5, 2020 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!"); } } }
hitmany Posted May 7, 2020 Author Posted May 7, 2020 (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 May 7, 2020 by hitmany 1
hitmany Posted May 7, 2020 Author Posted May 7, 2020 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
Tonytza Posted May 8, 2020 Posted May 8, 2020 Yes, that worked for me too! Thanks @hitmany for the quick tutorial.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now