Before you can create your first C# resource, you'll need to install Visual Studio 2022 (the community/free version will work just fine).
Win + R
, type in cmd
and then press Enter
. Now you should have a console like the one below:dotnet new -i CitizenFX.Templates
mkdir MyResource
cd MyResource
dotnet new cfx-resource
MyResource
with a solution file named MyResource.sln
. This is the solution file to manage your projects.build.cmd
, which will build a release server and client dll for you, both targeting the correct .NET Framework
needed for FiveM and FXServer.If you built the resource, you should now have a dist
folder available, so you should be able to run the following commands:
Change directory to the resource path named MyResource
:
cd /d [PATH TO THIS RESOURCE]
Make a symbolic link. For more information about mklink
, visit the following article by Microsoft.
mklink /d X:\cfx-server-data\resources\[local]\MyResource dist
Make sure you provide the right paths.
Afterwards, you can use ensure MyResource
in your server.cfg
or server console to start the resource.
Congratulations, you've created a resource using FiveM's C# templates!