Tools for developing mods for Kerbal Space Program
  • Shell 54.7%
  • Just 25%
  • C# 20.3%
Find a file
Andrew Cassidy 8da2de0659 Release 1.1.1
### Msbuild

- Fixed pdb files not being copied to GameData in Debug configuration
2025-12-01 00:14:10 -08:00
.github Release 1.1.1 2025-12-01 00:14:10 -08:00
docs fix link 2025-11-19 00:58:41 -08:00
tests Remove remaining traces of Log.cs 2025-11-16 20:41:17 -08:00
.gitignore Pin KSPBT actions within reusable workflows 2025-10-28 17:54:33 -07:00
CHANGELOG.md Release 1.1.1 2025-12-01 00:14:10 -08:00
justfile Use sd because trying to make anything work with GNU sed is an exercise in futility 2025-11-18 23:48:05 -08:00
KSPBuildTools.csproj Overhaul docs and update readme 2025-11-18 21:10:06 -08:00
KSPBuildTools.sln add an sln 2025-07-19 11:29:11 -07:00
KSPCommon.props Remove source includes 2025-11-16 20:38:18 -08:00
KSPCommon.targets Fix pdb files not being copied to GameData in Debug configuration 2025-12-01 00:10:47 -08:00
LICENSE.md Overhaul docs and update readme 2025-11-18 21:10:06 -08:00
README.md This was bugging me 2025-11-19 21:59:52 -08:00
update-version.sh fix update-version for when delete-template-files is false 2024-04-15 14:38:26 -04:00

KSP Build Tools

Documentation Status CI NuGet Version

This repository provides a common set of tools for developing mods for Kerbal Space Program. It integrates with MSBuild to simplify setting up plugins, and integrates with CKAN to easily reference other mods. it also includes a set of CI actions for automating builds.

Full Documentation

Installation

Run dotnet add package KSPBuildTools on your project, or add

<ItemGroup>
  <PackageReference Include="KSPBuildTools"/> 
</ItemGroup>

to the .csproj file. Pinning the version is highly recommended.

Usage

Once you have a KSP installation to link to, all the game DLLs will be automatically included in your project automatically.

Configure your mod's location in GameData and where to put the output DLLs

<!-- DLLs will be written to ../GameData/ModName/Plugins/ -->
<KSPBT_ModRoot>$(MSBuildThisFileDirectory)/../GameData/$(MSBuildProjectName)</KSPBT_ModRoot>
<KSPBT_ModPluginFolder>plugins</KSPBT_ModPluginFolder>

Reference dependency mods in your DLL by adding ModReference items to the project. They will be automatically installed using CKAN.

<!-- Depends on Modulemanager and Harmony -->
<ItemGroup>
  <ModReference Include="Modulemanager">
    <DLLPath>GameData/Modulemanager*.dll</DLLPath>
    <CKANIdentifier>ModuleManager</CKANIdentifier>
  </ModReference>
  <ModReference Include="0Harmony">
    <DLLPath>GameData/000_Harmony/0Harmony.dll</DLLPath>
    <CKANIdentifier>Harmony2</CKANIdentifier>
  </ModReference>
</ItemGroup>

Auto-generate version files from your project's FileVersion. This works well with minver.

<!-- Version Files -->
<ItemGroup>
  <KSPVersionFile Include=".">
    <Destination>$(KSPBT_ModRoot)/mymod.version</Destination>
    <URL>https://github.com/username/repo/releases/latest/download/mymod.version</URL>
    <Download>https://github.com/username.repo/releases/latest</Download>
  </KSPVersionFile>
</ItemGroup>

From there you should be able to build your mod with just dotnet build

For more details, see the MSBuild section in the docs.