Guad/NativeUI

NativeUI Preventing project build and breaking functionality

Ena-c opened this issue · 9 comments

Ena-c commented

I'm pretty new to creating mods on GTA 5 so not really sure how or what's causing this, but every time I reference nativeui in my code everything stops working, I have the NativeUI dll in the scripts folder and still doesn't fix anything, after this I tried to compile a project using nativeui into a dll and it because of the nativeui reference it prevented the project from compiling/building, I know it's not anything in my code because it works perfect without using nativeui
example:

// working code
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using GTA;
using GTA.Native;
using GTA.Math;

namespace Menu
{
    public class Main : Script
    {
        public Main()
        {
            this.Tick += onTick;
            this.KeyDown += onKeyDown;
        }

        void onTick(object sender, EventArgs e)
        {
        }

        void onKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.NumPad0)
            {
                UI.Notify("Hi");
            }
        }
    }
}
// broken code
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using GTA;
using GTA.Native;
using GTA.Math;
using NativeUI;

namespace Menu
{
    public class Main : Script
    {
        public Main()
        {
            this.Tick += onTick;
            this.KeyDown += onKeyDown;
        }

        void onTick(object sender, EventArgs e)
        {
        }

        void onKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.NumPad0)
            {
                UI.Notify("Hi");
            }
        }
    }
}

"Is just broken" is a bit vague. Please copy and paste the exception or show a screenshot of it.

Ena-c commented

"Is just broken" is a bit vague. Please copy and paste the exception or show a screenshot of it.

There is no exception, it just simply doesn't work and when building it just goes into a building loop and never completes

Please check your system and VS Configuration, I can compile your snippet with Visual Studio 2019 without problems.

1>------ Build started: Project: ClassLibrary1, Configuration: Debug Any CPU ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "NativeUI, Version=1.9.0.0, Culture=neutral, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "ScriptHookVDotNet2, Version=2.10.9.0, Culture=neutral, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
1>  ClassLibrary1 -> C:\Users\lemon\source\repos\ClassLibrary1\ClassLibrary1\bin\Debug\ClassLibrary1.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

image

Ena-c commented

I managed to compile but it still doesn't do anything when using it in gta, is there any additional things I need? I have scripthook dlls in the gta directory and the nativeui dll in the scripts folder with the script file

Check the log files first.

Ena-c commented

Where are the log files located?

Root of the game install (.log files).

Ena-c commented
[01:48:43] [DEBUG] Created script domain 'ScriptDomain_83EF7168' with v2.10.9.
[01:48:43] [DEBUG] Loading scripts from 'C:\Program Files\Rockstar Games\Grand Theft Auto V\scripts' into script domain 'ScriptDomain_83EF7168' ...
[01:48:43] [ERROR] Failed to compile 'Main.cs' with 1 error(s):
   at line 10: The type or namespace name 'NativeUI' could not be found (are you missing a using directive or an assembly reference?)

SHVDN can't compile .cs files that need external dependencies. Please create a solution on Visual Studio 2015/2017/2019 and use that.

Some information that can help you: