Environment Setup (Linux)
A guide to setting up a Suzerain mod development environment on Linux.
This guide covers Linux-specific setup only. For the full mod development walkthrough including code examples, see Developing Mods. For Windows setup, see Environment Setup (Windows).
This guide assumes you have already followed Installing Mods.
Setup
Install .NET SDK
Install the .NET 6 SDK for your Linux distribution.
Verify the installation:
dotnet --version
Install an IDE
Visual Studio is not available on Linux. The recommended alternatives are:
- JetBrains Rider - Full-featured .NET IDE.
- Visual Studio Code - Lightweight editor. Install the C# Dev Kit extension for C# support.
Create the Project
Create a new class library project targeting .NET 6:
dotnet new classlib -n MyMod -f net6
cd MyMod
Open the generated .csproj file and replace its contents with the following.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6</TargetFramework>
<Platforms>x64</Platforms>
<GamePath>$(HOME)/.local/share/Steam/steamapps/common/Suzerain</GamePath>
</PropertyGroup>
<ItemGroup>
<Reference Include="SuzerainModdingKit">
<HintPath>$(GamePath)/Mods/SuzerainModdingKit.dll</HintPath>
</Reference>
<Reference Include="MelonLoader">
<HintPath>$(GamePath)/MelonLoader/net6/MelonLoader.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
Note
If you installed Steam via Flatpak, set GamePath to:
$(HOME)/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/common/Suzerain
If you need to reference IL2CPP types directly (beyond what Suzerain Modding Kit exposes), add references to the interop assemblies generated by MelonLoader. These are found in $(GamePath)/MelonLoader/Il2CppAssemblies/ after launching the game at least once with MelonLoader installed.
Add Mod Metadata
Delete the generated Class1.cs and create Core.cs. Add the assembly-level attributes that identify your mod to MelonLoader. These must be outside any namespace declaration:
using MelonLoader;
using SuzerainModdingKit;
[assembly: MelonInfo(typeof(MyMod.Core), "My Mod", "1.0.0", "Your Name", null)]
[assembly: MelonGame("Torpor Games", "Suzerain")]
namespace MyMod;
internal sealed class Core : MelonMod
{
public override void OnInitializeMelon()
{
LoggerInstance.Msg("Initialized.");
}
}
Update the mod name (second argument of MelonInfo) and your name (fourth argument — ideally your Nexus Mods username).
Building and Installing
Build the mod targeting x64:
dotnet build -c Debug -p:Platform=x64
Use Debug when building for testing and Release when building for a public release. Replace Debug in the file paths below with Release when building in Release mode.
The compiled DLL is at bin/x64/Debug/net6/MyMod.dll. Copy it to the Suzerain Mods folder:
cp bin/x64/Debug/net6/MyMod.dll ~/.local/share/Steam/steamapps/common/Suzerain/Mods/
Or if you installed Steam via Flatpak:
cp bin/x64/Debug/net6/MyMod.dll ~/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/common/Suzerain/Mods/
Tip
Add a post-build target to your .csproj to copy the DLL automatically after each build:
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(GamePath)/Mods" />
</Target>
Launch Suzerain through Steam to test your mod. Check the MelonLoader console output for diagnostics.