---
description: >-
  This page describes how to make your own custom modification using Visual
  Studio.
---

# Building your Mod

You're looking to create a mod for Nitrocid KS! That's great! Make sure that you have Visual Studio installed. Follow the steps to create your first mod.

1.  Press `Create a new project` on Visual Studio homepage

    <figure><img src="https://content.gitbook.com/content/dDPcLxEVE2Wr3wAIGfTA/blobs/ySjZCm9b4ZoIF7JbIbky/077-modbuild.png" alt=""><figcaption></figcaption></figure>
2.  Find `Class Library` and double-click it

    <figure><img src="https://content.gitbook.com/content/dDPcLxEVE2Wr3wAIGfTA/blobs/0dqI7YrM4LMgWMUYRxrF/078-modbuild.png" alt=""><figcaption></figcaption></figure>
3.  Write your mod name, like in our example, `MyFirstMod`.

    <figure><img src="https://content.gitbook.com/content/dDPcLxEVE2Wr3wAIGfTA/blobs/urfxVKQyslzFRmBPHvZm/079-modbuild.png" alt=""><figcaption></figcaption></figure>
4.  Make sure that `.NET 8.0` is used. Press `Create`.

    <figure><img src="https://content.gitbook.com/content/dDPcLxEVE2Wr3wAIGfTA/blobs/e2vLp453gT6EtdmnOJIp/080-modbuild.png" alt=""><figcaption></figcaption></figure>
5.  Right-click on `Dependencies` -> `Manage NuGet Packages`, find `KS`, and install it.

    <figure><img src="https://content.gitbook.com/content/dDPcLxEVE2Wr3wAIGfTA/blobs/1Hq0T7m0fuPKkdYLhCeF/081-modbuild.png" alt=""><figcaption></figcaption></figure>
6.  Once the package is installed, go to the `Class1.cs` source file

    <figure><img src="https://content.gitbook.com/content/dDPcLxEVE2Wr3wAIGfTA/blobs/3i2g2ScVDN8blBYi0N1V/082-modbuild.png" alt=""><figcaption></figcaption></figure>
7.  Write next to the class file `: IMod` and import the required namespace `by using Nitrocid.Modifications;`. You should see errors indicating that you have to implement the methods.

    <figure><img src="https://content.gitbook.com/content/dDPcLxEVE2Wr3wAIGfTA/blobs/q4UcduIMKxI1EZALDur8/083-modbuild.png" alt=""><figcaption></figcaption></figure>
8.  After implementation, you should see:

    <figure><img src="https://content.gitbook.com/content/dDPcLxEVE2Wr3wAIGfTA/blobs/AzBdtWMV9rx2lMQ6ai3g/084-modbuild.png" alt=""><figcaption></figcaption></figure>
9.  Remove all calls to `NotImplementedException` and set the minimum supported API version. Currently, we're at `v3.0.25.437`.

    <figure><img src="https://content.gitbook.com/content/dDPcLxEVE2Wr3wAIGfTA/blobs/jWFR2PhvLZ2ohUhEV4qT/085-modbuild.png" alt=""><figcaption></figcaption></figure>
10. Now, implement everything as you wish. Once you're done, follow the steps on how to create a strong name signing key and [sign your mod](https://learn.microsoft.com/en-us/dotnet/standard/assembly/sign-strong-name). Then, click on the `Build` menu and select `Build Solution`.

    <div align="left"><figure><img src="https://content.gitbook.com/content/dDPcLxEVE2Wr3wAIGfTA/blobs/5M1ZEH9qABdQ4WQfETBw/086-modbuild.png" alt=""><figcaption></figcaption></figure></div>
11. Once the solution is built, open the file explorer to the solution directory by right-clicking on the solution and selecting `Open Folder in File Explorer`.

    <div align="left"><figure><img src="https://content.gitbook.com/content/dDPcLxEVE2Wr3wAIGfTA/blobs/mf3YWLK5QmKWPPO6zuus/087-modbuild.png" alt=""><figcaption></figcaption></figure></div>
12. Navigate to the output directory and copy the `.dll` file to `KSMods` under the `%localappdata%/KS` folder.

    <figure><img src="https://content.gitbook.com/content/dDPcLxEVE2Wr3wAIGfTA/blobs/LhOvKaIPLpQBKCR3iOwn/088-modbuild.png" alt=""><figcaption></figcaption></figure>
13. Open Nitrocid KS to test your mod. Ensure that `modman list` lists your mod.

    <figure><img src="https://content.gitbook.com/content/dDPcLxEVE2Wr3wAIGfTA/blobs/OgZ7DTAPqFLimBOUVtXn/089-modbuild.png" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You will have to turn on kernel modifications from the kernel settings. Navigate to `General > Start kernel modifications on boot` and turn it on.

You can also make use of the [`KSTemplates`](https://github.com/Aptivi/KSTemplates) repository, which can be installed to Visual Studio using the `dotnet new install path/to/KS.Templates.nupkg` command. It installs both C# and Visual Basic templates for your mods.
{% endhint %}

## Bleeding-edge builds

Bleeding-edge NuGet builds are available in our organization's GitHub Package Registry. In order to use such builds, you'll need to consult the <mark style="color:green;">**Installing canary NuGet packages**</mark> section of the below page:

{% content-ref url="https://app.gitbook.com/s/Id4bob6wnHvpX4zbVVtI/csharp-libraries/installation-and-upgrade/installation" %}
[Installation](https://app.gitbook.com/s/Id4bob6wnHvpX4zbVVtI/csharp-libraries/installation-and-upgrade/installation)
{% endcontent-ref %}
