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
cmdand 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
MyResourcewith 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 targetting the correct .NET frameworks 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
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!