Skip to content

PEAKModding/BepInExTemplate

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BepInEx Template for PEAK

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 now you have the ability to do that.

Note

You must use .NET SDK 8 or newer to use this template. Older SDK versions are out of support.

From NuGet (Recommended)

Run the following command:

dotnet new install PEAKModding.BepInExTemplate

Tip

You can run dotnet new update to update all your dotnet templates. You should do this get the latest versions of everything with the latest fixes and improvements!

Manually

If you're contributing to the template or prefer a manual installation:

  1. Clone or download this repository
  2. Open a terminal at the root of the repository
  3. 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 Project

Open a terminal in your PEAK modding directory, and run:

Note

You should set up a Thunderstore team first so you can use its name in the optional --ts-team argument so the template can give you a mostly correctly configured packaging setup.

dotnet new peakmod --name ModName --guid com.github.YourAccount.ModName --ts-team YourThunderstoreTeam

Tip

If you are developing a public API, add the --library option for included NuGet metadata!

You can also use --no-tutorial to get rid of tutorial comments in the template. Note that this doesn't get rid of all comments.

You can run dotnet new peakmod --help to see all available options.

This will create a new directory with the mod name which contains the project.

You now have a (mostly) working setup. See Setting Up The Config File and Thunderstore Packaging for more.

Project Structure

This example demonstrates what files should appear and where:

~/Workspace/PEAK$ dotnet new peakmod --name MyCoolMod --guid com.github.PEAKModding.MyCoolMod --ts-team PEAKModding
The template "PEAK BepInEx Plugin" was created successfully.

~/Workspace/PEAK$ cd MyCoolMod/
~/Workspace/PEAK/MyCoolMod$ tree
.
├── CHANGELOG.md
├── Config.Build.user.props.template
├── Directory.Build.props
├── Directory.Build.targets
├── icon.png
├── LICENSE
├── MyCoolMod.sln
├── README.md
└── src
    └── MyCoolMod
        ├── MyCoolMod.csproj
        ├── Plugin.cs
        └── thunderstore.toml

3 directories, 12 files

The C# source files for your mod are located in ./src/<project-name>/. All files above that are more generic project configuration files.

The Directory.Build.* files contain shared configuration for all projects in subdirectories. 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

At the root of your new project you should see 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

This template comes with Thunderstore packaging built-in, using 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

Note

You can learn about different build options with dotnet build --help.
-c is short for --configuration and -v d is --verbosity detailed.

The built package will be found at artifacts/thunderstore/.

You can also directly publish to Thunderstore by including -property:PublishTS=true in the command.

Note

For publishing to Thunderstore, you need a Thunderstore API token. The publishing to Thunderstore option is intended to be used via automated GitHub actions workflows, so you don't need to worry about it.

GitHub Actions Publishing

Coming soon.

About

A BepInEx template configured for PEAK modding.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%