A .NET template for RimWorld mods prioritizing clean builds, automation, and sane deployment.
Stop bloating players' workshop folders with megabytes of useless files in .git/, .vs/, or obj/. This template helps you develop mods professionally with a robust MSBuild pipeline that handles bundling, packaging, and deployment automatically. It prevents the "Ate without table" of modding: uploading your entire source tree to Steam.
-
Clone this repository.
-
Install the template via CLI:
dotnet new install .
-
Visual Studio: Restart VS. You will now see "RimWorld Mod Template" in the "Create a new project" list.
The standout feature is the embedded build pipeline in RimWorldModTemplate.csproj. It hooks directly into standard MSBuild targets, eliminating the need for manual commands.
| Target | Triggered By | Description |
|---|---|---|
| Distribute | Build | Compiles, bundles dependencies (ILRepack), and stages a clean release in Dist/. |
| Deploy | Build | Symlinks Dist/ to your RimWorld Mods/ folder. |
| PrepareLaunch | Build | Generates ModsConfig.xml and a launch script for immediate debugging. |
| CustomClean | Clean | Wipes generated artifacts and links. |
-
Create: Select the template in Visual Studio.
- The wizard will prompt you for
Mod Author,Mod ID, andGame Directory. - Tip: Hover over the "i" icon next to fields for descriptions.
- The wizard will prompt you for
-
Build:
dotnet build
- Automatically compiles and bundles dependencies.
- Automatically distributes to
Dist/. - Automatically deploys (links) to your RimWorld
Mods/folder. - Automatically generates
ModsConfig.xmlandLaunchRimWorld.bat.
-
Run:
- Execute
LaunchRimWorld.bat(generated inbin\Debugorbin\Release). - This launches the game using a local SaveData folder (
SaveData/in your project root). This ensures your main game configs and saves are never touched by your dev environment.
- Execute
- Zero Junk:
Dist/contains only what the game needs. No.git,.vs, orobj. - Auto-About:
About.xmlis generated from project properties. - Bundled Deps: Harmony and RimWorld refs included via NuGet.
- Isolated Environment: Uses a local
SaveDatafolder to keep your actual game settings clean.
Unlike most mods, this template encourages wrapping shared content (Textures, Sounds, Defs) in a Shared subfolder within Dist/.
This structure prevents unexpected conflicts when some content is designed to load conditionally. The Public/ folder in your source mirrors this structure directly to Dist/, so organize your source assets accordingly. The Assemblies folder is automatically populated with your compiled DLLs during the build.
Thanks to CuteLasty, we can set up a proper debugging environment. The steps below outline his tutorial from the Ludeon Forums. These steps are not automated in this template as they involve installing the Unity Editor and modifying game files.
- Get Unity: Check the Unity version of your RimWorld install (Properties of
UnityPlayer.dll). Download the matching Unity Editor from the Unity Archive and install it. - Prepare Game Copy: Copy your RimWorld installation to a new folder (e.g.,
RimWorld_Debug). You can use your main install, but a separate copy is safer. - Modify Game Copy: Navigate to your Unity installation folder. Copy
UnityPlayer.dll,WinPixEventRuntime.dll, andWindowsPlayer.exefromEditor\Data\PlaybackEngines\windowsstandalonesupport\Variations\win64_player_development_monoto your debug game copy, replacing existing files (WindowsPlayer.exereplacesRimWorldWin64.exe). If using your main install, back up these files first. - Enable Debugging: Create
RimWorldWin64_Data\boot.configin the debug folder and add:wait-for-managed-debugger=1 player-connection-debug=1 - Visual Studio: Install the Visual Studio Tools for Unity workload.
- Attach: Update the
GameDirvariable in your.csprojto point to your debug game copy. Build and run. A dialog will appear, prompting you to attach an debugger; go toDebug -> Attach Unity Debuggerin VS and select the process. - Debug: Enjoy breakpoints, variable inspection, and all the usual debugging features!