Creating a Project
Creating a mod for PEAK is simple using the official BepInEx template. This guide covers installing the template, generating a project, and configuring it for development.
Installing
Section titled “Installing”.NET templates must be installed before they can be used. This means that when you install the template, it doesn’t create a new project for you, but you will get the ability to do that.
Once you have the template installed, you don’t need to install it again, through it’s a good idea to update it if there are updates.
See the BepInEx Template repository
From NuGet (Recommended)
Section titled “From NuGet (Recommended)”Install the template by running:
dotnet new install PEAKModding.BepInExTemplate
Manual Install
Section titled “Manual Install”If you’re contributing to the template or prefer manual installation:
- Clone or download this repository
- Open a terminal in the root of the project
- Run:
dotnet new install .
To update:
dotnet new install . --force
To uninstall:
dotnet new uninstall .
Once installed, the template will be available as PEAK BepInEx Plugin
with an alias peakmod
.
Creating a New Mod
Section titled “Creating a New Mod”Run the following command in your PEAK modding directory:
dotnet new peakmod --name ModName --guid com.github.YourAccount.ModName --ts-team YourThunderstoreTeam
This will create a new folder called ModName
with your mod’s project.
Project Structure
Section titled “Project Structure”This example demonstrates the structure of the project after using the template:
~/Workspace/PEAK$ dotnet new peakmod --name PeakMod --guid com.github.PEAKModding --ts-team PEAKModdingThe template "PEAK BepInEx Plugin" was created successfully.
~/Workspace/PEAK$ cd PeakMod/
The file structure in PeakMod/
should look like this:
- CHANGELOG.md
- Config.Build.user.props.template
- Directory.Build.props
- Directory.Build.targets
- icon.png
- LICENSE
- PeakMod.sln
- README.md
Directorysrc
DirectoryPeakMod
- PeakMod.csproj
- Plugin.cs
- thunderstore.toml
Key points:
- Your mod code is in
./src/<project-name>/
Directory.Build.*
files define shared build configuration<project-name>.sln
is your project solution
The project is configured so that it’s easy to add new projects into your project solution. Even if you don’t need that, it’s good to follow this standard project structure.
Setting Up The Config File
Section titled “Setting Up The Config File”At the root of your new project you should see a file named Config.Build.user.props.template
. This is a special file that is the template for the project’s user-specific config. Make a copy of this file and rename it Config.Build.user.props
without the template part.
This file will copy your assembly files to a plugins directory and it can be used to configure your paths to the game files and BepInEx plugins directory if the defaults don’t work for you.
Thunderstore Packaging
Section titled “Thunderstore Packaging”This template comes with Thunderstore packaging built-in, using Thunderstore CLI, aka TCLI. You should configure the src/<project-name>/thunderstore.toml
file for your mod, such as setting the description for your mod.
You can build Thunderstore packages by running:
dotnet build -c Release -target:PackTS -v d
The built package will be found at artifacts/thunderstore/
.
You can also directly publish to Thunderstore by including -property:PublishTS=true
in the command.
GitHub Actions Publishing
Section titled “GitHub Actions Publishing”Coming soon.