Trouble running C# mono_v2 resource

Hi! I’m trying to get started with C# for FiveM using the mono_v2 runtime. I followed the instructions in GitHub - thorium-cfx/mono_v2_get_started: Mono v2 runtime for FiveM/RedM and combined it with the build script etc from the regular C# template. I uploaded it to github here: GitHub - r3ps4J-FiveM/MonoTest

For some reason the script does not run. I don’t see “Hi from MonoTest.Client!” or “Hi from MonoTest.Server!” in the client and server console respectively. And the command and tick also don’t work. I tried changing the namespace to the ones used by the template, but that did not change anything.

I think I set up the fxmanifest correctly. I specified the client and server dll directly since these were selected with *.net.dll in the template (since .net is no longer included and otherwise it would match the other dlls). And I also changed the build script to look for the net452 folder as used by the mono_v2 getting started repository.

I’m new to C# and dotnet, so I’m not sure what could be going wrong here. Does anyone have any idea?

I couldn’t find anything about mono v2 actually expiring on 2023-06-30. I’m assuming it still works since the dlls are still included with the client and server artifacts. If not, please let me know as it would make sense that it’s not running.

Thanks in advance!

The projects should have dlls ended with this x.net.dll, that’s why you see that in the fxmanifest. You can take a look into that here: GitHub - DaniGP17/mono-v2-fivem-template: Starter template to use the mono v2 runtime for FiveM/RedM

That was it, thanks a lot! I looked it up in the docs as well and it only runs scripts ending with .net.dll. Found it here if anyone comes across this in the future: Resource manifest - Cfx.re Docs

Some further questions though. I see that you’re targeting net6.0. I thought fivem does not support anything higher than 4.8 due to the sandboxing issues (and net452 being the actual supported version). Do you do something special to make it work or was support for higher dotnet versions added?

And do you happen to know how the official template made it so that the client and server dlls produce .net.dll files without having the project files be named .net.csproj?

That is due to my mistake, but if I’m not mistaken it works even if it is pointing to net6.0, I don’t know much about the issue of versions so I couldn’t clarify this for you.
You do not need to change the name of the .csproj file, in visual studio when you open the project properties and in the application section you will see that you can change the assembly name.

Ah that works. Makes it a bit cleaner than renaming the project files.

I appended .net to the default assembly name and it added

<AssemblyName>$(MSBuildProjectName).net</AssemblyName>

to the PropertyGroup inside the .csproj files.

Thanks again!

And changing my target version to net6.0 does indeed seem to work, which is rather interesting since there are a lot of posts here on the forum that say it’s impossible to support it. Setting it to net8.0 works as well. Maybe it works due to my code not using anything from net 6.0? Not sure how that works under the hood.

Yes, it seems like a better solution. Yes, I suppose it will only give an error if you use some net6.0 functionality but I’m not sure