Skip to content

LethalCompanyModding/BepinExTemplateSimple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BepInEx Template for Lethal Company

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 10 or newer to use this template. You can check your .NET SDK version by running the following in a terminal: dotnet --version. To download .NET SDK, see: https://dotnet.microsoft.com/en-us/download

From NuGet (Recommended)

Run the following command:

dotnet new install LethalCompanyModding.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 Lethal Company BepInEx Plugin with an alias lcmod.

Creating a Project

Open a terminal in your Lethal Company 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 lcmod --output 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 lcmod --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/LethalCompany$ dotnet new lcmod --output MyCoolMod --guid com.github.LethalCompanyModding.MyCoolMod --ts-team LethalCompanyModding
The template "LethalCompany BepInEx Plugin" was created successfully.

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

3 directories, 13 files
  • ./src/<project-name>/ contains the C# source files for your mod
    • <project-name>.csproj is the C# project configuration file, which builds a dll file
    • Plugin.cs is the C# source code file which defines your BepInEx plugin class
    • thunderstore.toml is a metadata file for packaging your mod with Thunderstore CLI (see Thunderstore Packaging)
  • ./ contains project configuration files
    • Directory.Build.* files contain shared configuration for all projects in subdirectories
    • Config.Build.user.props.template is a template file for per-user configuration (see Setting Up The Config File)
    • <project-name>.slnx is file which defines which csproj files are included in your project
    • global.json informs your dev tools of the minimum supported .NET SDK version for the project
    • CHANGELOG.md, icon.png, LICENSE, and README.md are placeholder files which are to be modified by you
      • These are included in your Thunderstore package, which is configured in ./src/<project-name>/thunderstore.toml

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 a good idea to follow a standard project structure in case a need ever comes, or just so that everything is where you'd expect it to be. For example, does your project need automated tests? Copy your ./src/<project-name>/ plugin's csproj and Plugin.cs to ./tests/<project-name>.Tests/, add the new csproj to your slnx project, and start working on your test project.

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 -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 sometime, possibly.

About

A very simple template for users that do not need or require automated TS publishing

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors

Languages