Skip to main content
The template project is pre-configured to compile your plugin and copy the output DLL straight into ChroMapper’s Plugins folder as part of the build. This page walks through everything you need to do from setting up your environment to verifying your plugin loads.

Prerequisites

You must set the ChroMapperDir environment variable to your ChroMapper installation path before building. The .csproj uses $(ChroMapperDir) in every HintPath reference to locate Unity and ChroMapper DLLs. If the variable is missing or incorrect, MSBuild cannot resolve the references and the build will fail with “missing file” errors.
Set the variable in your user environment (persists across sessions):
[System.Environment]::SetEnvironmentVariable("ChroMapperDir", "C:\Program Files\ChroMapper", "User")
Or set it for the current shell session only:
$env:ChroMapperDir = "C:\Program Files\ChroMapper"

Restore NuGet packages

The project depends on Krafs.Publicizer 2.3.0. You must restore packages before your first build, otherwise the EnsureNuGetPackageBuildImports target will abort the build with:
This project references NuGet package(s) that are missing on this computer.
The missing file is ..\packages\Krafs.Publicizer.2.3.0\build\Krafs.Publicizer.props
Restore from the command line:
nuget restore
Or let Visual Studio restore packages automatically when you open the solution — it prompts you if packages are missing.

Build configurations

The project ships with two standard MSBuild configurations:
ConfigurationDebugSymbolsOptimizeOutput pathExtra output
Debugtrue (full)falsebin\Debug\.pdb file copied to Plugins\
Releasepdbonlytruebin\Release\DLL only
Use Debug during development — the .pdb file lets Unity’s stack traces show line numbers. Use Release for distribution.

The post-build deploy step

After every successful build the .csproj runs a PostBuild target that copies the output to ChroMapper’s Plugins directory:
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="xcopy /Y /F &quot;$(ProjectDir)bin\$(Configuration)\$(TargetName).dll&quot; &quot;$(ChroMapperDir)\Plugins\&quot;" />
    <Exec Condition=" '$(Configuration)' == 'Debug' " Command="xcopy /Y /F &quot;$(ProjectDir)bin\$(Configuration)\$(TargetName).pdb&quot; &quot;$(ChroMapperDir)\Plugins\&quot;" />
</Target>
  • The first <Exec> always copies the DLL.
  • The second <Exec> only runs in the Debug configuration and copies the .pdb alongside it.
The /Y flag overwrites without prompting; /F prints the source and destination paths so you can confirm the copy happened in the build output.

Building from the CLI

1

Open a terminal in the project directory

Navigate to the folder that contains your .csproj file.
2

Build in Debug mode

dotnet build
MSBuild defaults to the Debug configuration when none is specified.
3

Build in Release mode

dotnet build -c Release
You can also invoke MSBuild directly if dotnet build is not available:
msbuild MyPlugin.csproj /p:Configuration=Release

Building from Visual Studio

1

Open the solution

Double-click your .csproj or open Visual Studio and use File → Open → Project/Solution.
2

Select a configuration

Choose Debug or Release from the configuration dropdown in the toolbar.
3

Build

Press Ctrl+Shift+B or go to Build → Build Solution.
The Output window shows the xcopy lines from the post-build step, confirming the DLL was copied to $(ChroMapperDir)\Plugins\.

Where ChroMapper loads plugins from

ChroMapper scans the Plugins subdirectory of its installation folder on startup. The post-build target writes your DLL there automatically, so a clean build-then-launch cycle is all you need:
<ChroMapperDir>\
└── Plugins\
    └── MyPlugin.dll       ← your plugin
    └── MyPlugin.pdb       ← debug symbols (Debug build only)

Verifying your plugin loaded

Your plugin’s Init method emits a log message:
Debug.Log($"Hello from {Name}!");
Check for it in one of two places:
  1. ChroMapper’s in-editor console — visible at the bottom of the ChroMapper window if the developer console is open.
  2. Unity’s player log — written to:
    %APPDATA%\..\LocalLow\BinaryElement\ChroMapper\Player.log
    
    Search the log for your plugin’s name to confirm it initialised without errors.
Check the following:
  • The DLL is in $(ChroMapperDir)\Plugins\ (the post-build xcopy output confirms this).
  • The class is decorated with [Plugin(Name)] and the init method with [Init].
  • NuGet packages were restored — an incomplete Krafs.Publicizer restore can silently produce a DLL that fails to load.
  • The ChroMapperDir variable pointed to the correct installation when you built.

Build docs developers (and LLMs) love