First time posting here so sorry if this is the wrong area. I have been working with c# for a while so I know the syntax and I know how to work with class libraries with normal projects. Anyway my question is how do I reference other resources. for example usually you would do something like
namespace MyResourceName
{
public class Config
{
public static string myString;
public static int myInt;
}
}
then you would build that and reference the dll in the other script and do something like
using MyResourceName;
public class MyOtherResource
{
public void main()
{
string myString = Config.myString;
int myInt = Config.myInt;
}
}
This obviously does not work with FiveM. I’m aware you are suppose to do something with exports… but I have been unable to figure this out. What I am trying to do is have a core resource that holds all the main config and reference that resource from other resources.
EDIT:
I’ve been messing around with stuff and i think I have come to the conclusion that my issue is to do with an error that I’m pretty sure is on the FxDK side
Error: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Users\****\.nuget\packages\citizenfx.core.server\1.0.5054\lib\netstandard20\CitizenFX.Core.Server.dll", "AMD64". This mismatch may cause runtime failures.
This error is causing compiler issues which I’m pretty sure is what is casing issues with exports in c#.
if I try opening the project in visual studio 2017 the recommended version on the docs its just causes even more issues so not quite sure how to go about fixing it.
EDIT 2:
I seem to have figured out how to fix the above error by adding
<PlatformTarget>x64</PlatformTarget>
to the .csproj file
so original that FxDK generates looks something like this for the client
<Project Sdk="CitizenFX.Sdk.Client/0.2.2">
<ItemGroup>
<Compile Include="../Shared/**/*.cs" />
</ItemGroup>
</Project>
I changed it to this and the error has stopped appearing
<Project Sdk="CitizenFX.Sdk.Client/0.2.2">
<ItemGroup>
<Compile Include="../Shared/**/*.cs" />
</ItemGroup>
<PropertyGroup>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
</Project>
I also added the platform target to the server csproj file as well and everything seems to be working correctly… now back to trying to figure out the exports stuff.
solution: