Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ba90899
minor cleanup
Hamunii Jun 20, 2025
6f73e12
initial PEAK changes
Hamunii Jun 20, 2025
33b8064
rename template
Hamunii Jun 20, 2025
89f036f
unpack into a directory
Hamunii Jun 20, 2025
f478fcc
add comments to csproj
Hamunii Jun 20, 2025
adc537f
add guid option
Hamunii Jun 20, 2025
1125e10
add no-tutorial option to hide tutorial comments
Hamunii Jun 20, 2025
a40cca4
update readme
Hamunii Jun 20, 2025
ec5ca12
add library option for nuget metadata
Hamunii Jun 20, 2025
b569df2
add Thunderstore packaging
Hamunii Jun 20, 2025
b810729
change how Config.Build.user.props works
Hamunii Jun 20, 2025
f4a8582
update readme to reflect changes
Hamunii Jun 20, 2025
5cdb684
fix the template
Hamunii Jun 20, 2025
3a04118
update directory tree in readme
Hamunii Jun 20, 2025
fffeb1f
mention TS packaging in readme
Hamunii Jun 20, 2025
8372851
readme improvements
Hamunii Jun 20, 2025
7df11ab
fix not having local assembly references by default
Hamunii Jun 21, 2025
56b262c
make Thunderstore team optional
Hamunii Jun 21, 2025
d75a489
fix thunderstore packaging
Hamunii Jun 21, 2025
0fadd0c
bump version number
Hamunii Jun 21, 2025
987a95e
better comments
Hamunii Jun 21, 2025
b0bd312
add NuGet sources in Directory.Build.targets instead
Hamunii Jun 21, 2025
9637bde
remove NuGet.Config from readme tree
Hamunii Jun 21, 2025
fd51cc7
add comment about AutoPlugin
Hamunii Jun 21, 2025
e93a2de
add link to AutoPlugin repository
Hamunii Jun 21, 2025
67451f4
add basic instructions to template readme
Hamunii Jun 22, 2025
5981183
improve readmes more
Hamunii Jun 22, 2025
2482111
bump version number
Hamunii Jun 22, 2025
b2c41bb
fix Config.Build.user.props being imported too late
Hamunii Jun 22, 2025
62424f1
add TODO comment to license file
Hamunii Jun 22, 2025
a0a9bb0
generic version to easily make template for other games
Hamunii Jun 23, 2025
00d70b2
make it for Lethal Company
Hamunii Jun 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .csharpierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore everything because some template stuff
# does not conform to standard formatting.
*
119 changes: 91 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,116 @@
# BepInExModTemplate (Simple) for Lethal Company
# BepInEx Template for Lethal Company

This Repo is a simple alternative for the BepInEx+Publishing Template in the Lethal Company Community
- [BepInEx Template for Lethal Company](#bepinex-template-for-lethal-company)
- [Installing](#installing)
- [From Nuget](#from-nuget)
- [Manually](#manually)
- [Creating a Project](#creating-a-project)
- [Project Structure](#project-structure)
- [Setting Up The Config File](#setting-up-the-config-file)
- [Thunderstore Packaging](#thunderstore-packaging)
- [GitHub Actions Publishing](#github-actions-publishing)

- [Installing (Nuget)](#installing-nuget)
- [Installing (Manually)](#installing-manually)
- [Using](#using)
- [Setting Up The Config File](#setting-up-the-config-file)
- [Manually Using the Build Directives](#manually-using-the-build-directives)
## Installing

## Installing (Nuget)
.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.

Run the following command
> [!NOTE]
> You must use .NET SDK 8 or newer to use this template. Older SDK versions are out of support.

### From Nuget

Run the following command:

```bash
dotnet new install dev.mamallama.lethal.bepinsimple
```

## Installing (Manually)
### Manually

- Download this repo's source or clone it to your local computer.
- Navigate inside the DotNetTemplate folder
If you don't want to install via NuGet or are contributing to this template, you can follow these steps:

- Download this repo's source or clone it to your local computer
- Navigate inside the repository root directory
- Open a Terminal/Powershell/Bash window inside this folder and use the following command to install it: `dotnet new install .`
- Note: If you are updating the template from an older version use `dotnet new install . --force` instead
- Note: To uninstall it, run `dotnet new uninstall .`

Great! The template is now installed locally as Lethal Company BepInEx Plugin.

## Creating a Project

> [!TIP]
> If you've done this before, you can use the `--no-tutorial` option to get rid of tutorial comments. Note that this doesn't get rid of *all* comments.

Open a terminal in your Lethal Company modding directory, and run:

```sh
dotnet new LethalBepinSimplePlugin --name ModName --guid com.github.YourAccount.ModName --ts-team YourThunderstoreTeam
```

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](#setting-up-the-config-file) and [Thunderstore Packaging](#thunderstore-packaging) for more.

Great! The template is now installed locally as OSBepinPlugin
### Project Structure

## Using
This example demonstrates what files should appear and where:

- Create a new folder wherever you'd like your new project to be
- Give it a nice name, this folder name will be your whole project's name
- Open a Terminal/Powershell/Bash window inside this folder and use the following command to instance a new plugin `dotnet new LethalBepinSimplePlugin`
```sh
~/Workspace/LethalCompany$ dotnet new LethalBepinSimplePlugin --name MyCoolMod --guid com.github.LethalCompanyModding.MyCoolMod --ts-team LethalCompanyModding
The template "LethalCompany BepInEx Plugin" was created successfully.

You now have a (mostly) working setup. For automated build copying you'll need to follow some extra steps!
~/Workspace/LethalCompany$ cd MyCoolMod/
~/Workspace/LethalCompany/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 config. It needs to know where your copy of the game is.
Make a copy of this file and rename it `Config.Build.user.props` without the template part. Open it in a text editor and replace `full/path/to/game` inside `<GameDir>full/path/to/game</GameDir>` with the actual full path to your game. This is the path when you right click the game in your Steam library and select "Browse Local Files"
Save the file and you're ready to start making a mod!
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

## Manually Using the Build Directives
This template comes with Thunderstore packaging built-in, using [TCLI](<https://github.com/thunderstore-io/thunderstore-cli>). You should configure the `src/<project-name>/thunderstore.toml` file for your mod, such as setting the description for your mod.

I've tried to include both Visual Studio and Visual Studio Code tasks for building and deploying the plugin to your game directory but if for some reason these don't work you can use the following commands in the terminal in your project folder that contains the `.sln` file
You can build Thunderstore packages by running:

```sh
dotnet build -c Release -target:PackTS -v d
```

> [!NOTE]
> These actions depend on the config file being set up!
> 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.

- `dotnet build -p:DeployToProd=true` to build and deploy to your plugins folder
- `dotnet build -p:BuildStaging=true` to build the project and zip it up in the `artifacts` folder. This zip will be suitable for github releases
### GitHub Actions Publishing

> [!WARNING]
> The BuildToStaging action depends on your project having a LICENSE file in the root folder alongside the solution file!
Coming soon.
16 changes: 9 additions & 7 deletions Template.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
<!-- Follow the instructions on
https://learn.microsoft.com/en-us/nuget/create-packages/package-authoring-best-practices -->
<PackageId>dev.mamallama.lethal.bepinsimple</PackageId>
<PackageVersion>1.0.0</PackageVersion>
<Title>Lethal Company BepInEx Plugin Simple Template</Title>
<Authors>Robyn</Authors>
<Description>A simple BepInEx template for making mods for Lethal Company</Description>
<PackageVersion>1.0.6</PackageVersion>
<Title>Lethal Company BepInEx Template</Title>
<Authors>Robyn, Hamunii</Authors>
<Description>A BepInEx template for making mods for Lethal Company</Description>
<PackageTags>dotnet new; template; BepInEx; Lethal Company</PackageTags>
<PackageProjectUrl>https://github.com/LethalCompanyModding/BepinExTemplateSimple</PackageProjectUrl>
<PackageProjectUrl>https://github.com/dev.mamallama.lethal/BepInExTemplate</PackageProjectUrl>
<!-- Publish the repository URL in the built .nupkg (in the NuSpec <repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageLicenseExpression>CC0-1.0</PackageLicenseExpression>

<!-- Keep package type as 'Template' to show the package as a template package on nuget.org and
Expand All @@ -35,8 +37,8 @@
</ItemGroup>

<ItemGroup>
<Content Include="content\**\*" Exclude="content\**\bin\**;content\**\obj\**" />
<Compile Remove="**\*" />
<Content Include="content/**" Exclude="content/*/artifacts/**;content/*/Config.Build.user.props" />
<Compile Remove="**/*" />
</ItemGroup>

<ItemGroup>
Expand Down
60 changes: 60 additions & 0 deletions content/.template.config/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "dev.mamallama.lethal",
"classifications": [
"Console"
],
"guids": [
"725F983D-24CD-4EC1-A08A-FEF64D1A04D0",
"B0F2818C-F976-4923-B01A-D9A7319E0E8A"
],
"identity": "com.github.dev.mamallama.lethal.bepinsimple",
"name": "Lethal Company BepInEx Plugin",
"shortName": "LethalBepinSimplePlugin",
"tags": {
"language": "C#",
"type": "project"
},
"sourceName": "BepInExModTemplate",
"defaultName": "MyPlugin",
"symbols": {
"guid": {
"type": "parameter",
"displayName": "GUID",
"description": "The global identifier for your mod. Example: com.github.YourAccount.ModName",
"datatype": "text",
"replaces": "_Guid_",
"isRequired": "true"
},
"ts-team": {
"type": "parameter",
"displayName": "Thunderstore Team",
"description": "The thunderstore team to publish this package under.",
"datatype": "text",
"replaces": "_ts-team_",
"defaultValue": "TODO: Fill in your Thunderstore team name here"
},
"no-tutorial": {
"type": "parameter",
"displayName": "No Tutorial",
"description": "If true, tutorial comments will not be present.",
"datatype": "bool",
"defaultValue": "false"
},
"library": {
"type": "parameter",
"displayName": "Library",
"description": "If true, NuGet metadata is included in the project.",
"datatype": "bool",
"defaultValue": "false"
},
"725F983D-24CD-4EC1-A08A-FEF64D1A04D0": {
"type": "generated",
"generator": "guid"
},
"B0F2818C-F976-4923-B01A-D9A7319E0E8A": {
"type": "generated",
"generator": "guid"
}
}
}
13 changes: 13 additions & 0 deletions content/BepInExModTemplate/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"tcli": {
"version": "0.2.4",
"commands": [
"tcli"
],
"rollForward": false
}
}
}
3 changes: 3 additions & 0 deletions content/BepInExModTemplate/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

TODO: You can follow this format for your changelog: <https://keepachangelog.com/en/1.1.0/>
16 changes: 16 additions & 0 deletions content/BepInExModTemplate/Config.Build.user.props.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project>

<PropertyGroup>
<!-- Set if the default steam game install directory doesn't work. -->
<!-- <LethalCompanyGameRootDir></LethalCompanyGameRootDir> -->
<!-- Set if your BepInEx/plugins/ directory isn't in the game files. -->
<!-- <LethalCompanyPluginsDir></LethalCompanyPluginsDir> -->
</PropertyGroup>

<Target Name="DeployFiles" AfterTargets="Build">
<Message Text="Deploy → $(LethalCompanyPluginsDir)$(AssemblyName).dll" Importance="High" />
<Error Text="Plugins directory '$(LethalCompanyPluginsDir)' doesn't exist!" Condition="!Exists('$(LethalCompanyPluginsDir)')" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(LethalCompanyPluginsDir)" />
</Target>

</Project>
74 changes: 74 additions & 0 deletions content/BepInExModTemplate/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<Project>
<!--#if (!no-tutorial) -->
<!--
This is a special file that contains shared configuration
for all project files in subdirectories.
-->
<!--#endif -->

<!-- Import our shared user configuration file -->
<Import
Project="$(SolutionRoot)Config.Build.user.props"
Condition="Exists('$(SolutionRoot)Config.Build.user.props')"
/>

<!--#if (library) -->
<!-- NuGet -->
<PropertyGroup>
<IsPackable>false</IsPackable>
<!--
TODO: Fill these values. See:
https://learn.microsoft.com/en-us/nuget/create-packages/package-authoring-best-practices
-->
<Authors></Authors>
<PackageLicenseExpression></PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>icon.png</PackageIcon>
<PackageTags>Lethal Company;$(PackageTags)</PackageTags>
</PropertyGroup>

<!--#endif -->
<!-- Primary configuration for the project -->
<PropertyGroup>
<!--#if (!no-tutorial) -->
<!-- Use latest C# version. -->
<!--#endif -->
<LangVersion>latest</LangVersion>
<!--#if (!no-tutorial) -->
<!-- See: https://learn.microsoft.com/en-us/dotnet/csharp/nullable-references -->
<!--#endif -->
<Nullable>enable</Nullable>
<!--#if (!no-tutorial) -->
<!-- Build, and other generated files go nicely into artifacts/ directory. -->
<!--#endif -->
<UseArtifactsOutput>true</UseArtifactsOutput>
<!--#if (!no-tutorial) -->
<!-- Enable debug symbols. This will show source code line numbers in stack traces. -->
<!--#endif -->
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<!--#if (!no-tutorial) -->
<!-- Substitute full path to this directory with ./, hiding it from debug symbols. -->
<!--#endif -->
<PathMap>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))=./</PathMap>
</PropertyGroup>

<!-- Custom props -->
<PropertyGroup>
<!--#if (!no-tutorial) -->
<!-- Define a variable that points to this directory. -->
<!--#endif -->
<SolutionRoot>$(MSBuildThisFileDirectory)</SolutionRoot>
<!--#if (!no-tutorial) -->
<!-- Default values for game files. -->
<!--#endif -->
<PathBeforeSteam Condition="'$([MSBuild]::IsOSUnixLike())' == 'true'">$(HOME)/.local/share/</PathBeforeSteam>
<PathBeforeSteam Condition="'$([MSBuild]::IsOSUnixLike())' != 'true'">$(MSBuildProgramFiles32)/</PathBeforeSteam>
<LethalCompanyGameRootDir Condition="$(LethalCompanyGameRootDir) == ''">$(PathBeforeSteam)Steam/steamapps/common/Lethal Company/</LethalCompanyGameRootDir>
<LethalCompanyPluginsDir Condition="$(LethalCompanyPluginsDir) == ''">$(LethalCompanyGameRootDir)/BepInEx/plugins/</LethalCompanyPluginsDir>
<ManagedDir>$(LethalCompanyGameRootDir)/Lethal Company_Data/Managed/</ManagedDir>
</PropertyGroup>

</Project>
Loading