# 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://1453621892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyhORwVwuIgJMLsQRqN3S%2Fuploads%2FuyZBAADXJaDiikwh0k6q%2F077-modbuild.png?alt=media&#x26;token=80711074-acca-4243-9bab-8fd69d0820dd" alt=""><figcaption></figcaption></figure>
2. Find `Class Library` and double-click it

   <figure><img src="https://1453621892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyhORwVwuIgJMLsQRqN3S%2Fuploads%2FilUWWSmSfoVwN5MWxiNZ%2F078-modbuild.png?alt=media&#x26;token=66282352-5015-48fb-bca2-af8ea4e2b3fa" alt=""><figcaption></figcaption></figure>
3. Write your mod name, like in our example, `MyFirstMod`.

   <figure><img src="https://1453621892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyhORwVwuIgJMLsQRqN3S%2Fuploads%2FIFKCeBdM14U5YjaTm6if%2F079-modbuild.png?alt=media&#x26;token=c8b0851f-ff2d-42b1-b705-c6849dab7c45" alt=""><figcaption></figcaption></figure>
4. Make sure that `.NET 8.0` is used. Press `Create`.

   <figure><img src="https://1453621892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyhORwVwuIgJMLsQRqN3S%2Fuploads%2FV2cqnK0YLtk1hD86SarZ%2F080-modbuild.png?alt=media&#x26;token=fa1dc5dd-fa58-4322-9fb4-8b1ea9e6a992" alt=""><figcaption></figcaption></figure>
5. Right-click on `Dependencies` -> `Manage NuGet Packages`, find `KS`, and install it.

   <figure><img src="https://1453621892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyhORwVwuIgJMLsQRqN3S%2Fuploads%2Fk2dMCCGxjVhAtlgLJ26t%2F081-modbuild.png?alt=media&#x26;token=6a41c340-8a23-43cd-9195-22040c841e0a" alt=""><figcaption></figcaption></figure>
6. Once the package is installed, go to the `Class1.cs` source file

   <figure><img src="https://1453621892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyhORwVwuIgJMLsQRqN3S%2Fuploads%2F2ezRnhkq03zqje75KQ59%2F082-modbuild.png?alt=media&#x26;token=f499f855-7800-4d1f-8029-f420dec737c9" 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://1453621892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyhORwVwuIgJMLsQRqN3S%2Fuploads%2Fp0EHkJflTmjYFhcGcUPK%2F083-modbuild.png?alt=media&#x26;token=ff8c37a7-a538-4e8c-ba6f-f429cac9b8bd" alt=""><figcaption></figcaption></figure>
8. After implementation, you should see:

   <figure><img src="https://1453621892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyhORwVwuIgJMLsQRqN3S%2Fuploads%2Fxbnt86UnbP18aKCxtKR5%2F084-modbuild.png?alt=media&#x26;token=858ff6e9-8691-44db-9dbf-654e7f84a31d" 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://1453621892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyhORwVwuIgJMLsQRqN3S%2Fuploads%2FuTJ5rySmRne10ysfxty4%2F085-modbuild.png?alt=media&#x26;token=971b8cd0-9072-4d83-bccb-b097946f7b87" 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://1453621892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyhORwVwuIgJMLsQRqN3S%2Fuploads%2FylUy4FzIFrADWKS3off6%2F086-modbuild.png?alt=media&#x26;token=37233abc-f474-4632-8f84-3dd66b62e01d" 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://1453621892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyhORwVwuIgJMLsQRqN3S%2Fuploads%2Fxpds1Zdwjiq0LsHlZaNM%2F087-modbuild.png?alt=media&#x26;token=eeb0925d-6289-40a9-856c-0678f3daef9d" 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://1453621892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyhORwVwuIgJMLsQRqN3S%2Fuploads%2FUZU3i5j5zq006Eyh6kq1%2F088-modbuild.png?alt=media&#x26;token=f5e3a4a0-43e4-4078-9327-8fd5c7aca19d" alt=""><figcaption></figcaption></figure>
13. Open Nitrocid KS to test your mod. Ensure that `modman list` lists your mod.

    <figure><img src="https://1453621892-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyhORwVwuIgJMLsQRqN3S%2Fuploads%2FARGmHBDszAV5t2wrwTbQ%2F089-modbuild.png?alt=media&#x26;token=fa5635c6-4c85-40fe-a2a5-409619ae10a3" 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 %}
