Building The Project

Project Setup

Dependencies

To build Mapify, you'll need to have some dependencies installed.

If you're running windows, ensure you have Powershell 7 installed. If you're on Linux, you should be able to download it from your package manager.

Reference Directories

To ensure MSBuild and your IDE can find Derail Valley / Unity classes, and to avoid having to copy DLLs around, you'll need to create a Directory.Build.targets file to specify your reference paths. This file should be created in the root of the project, next to the LICENSE file.

You can use the examples below as templates depending on your operating system.

  • DvInstallDir is the directory where Derail Valley is installed (Where DerailValley.exe is located).
  • UnityInstallDir is the directory where Unity is installed (Where Unity.exe or Unity is located).
Windows

Here's an example file for Windows you can use as a template. Replace the provided paths with the paths to your Derail Valley installation directory. Make sure to include the semicolons between each of the paths, but not after the last one! Note that shortcuts like %ProgramFiles% cannot be used.

<Project>
    <PropertyGroup>
        <DvInstallDir>C:\Program Files (x86)\Steam\steamapps\common\Derail Valley</DvInstallDir>
        <UnityInstallDir>C:\Program Files\Unity\Hub\Editor\2019.4.40f1\Editor</UnityInstallDir>
        <ReferencePath>
            $(DvInstallDir)\DerailValley_Data\Managed\;
            $(DvInstallDir)\DerailValley_Data\Managed\UnityModManager\;
            $(UnityInstallDir)\Data\Managed\
        </ReferencePath>
        <AssemblySearchPaths>$(AssemblySearchPaths);$(ReferencePath);</AssemblySearchPaths>
    </PropertyGroup>
</Project>
Linux

Here's an example file for Linux you can use as a template. Replace the provided paths with the paths to your Derail Valley installation directory. Make sure to include the semicolons between each of the paths, but not after the last one!

<Project>
    <PropertyGroup>
        <DvInstallDir>/home/username/.local/share/Steam/steamapps/common/Derail Valley</DvInstallDir>
        <UnityInstallDir>/home/username/.local/share/UnityHub/Editor/2019.4.40f1/Editor</UnityInstallDir>
        <ReferencePath>
            $(DvInstallDir)/DerailValley_Data/Managed/;
            $(DvInstallDir)/DerailValley_Data/Managed/UnityModManager/;
            $(UnityInstallDir)/Data/Managed/
        </ReferencePath>
        <AssemblySearchPaths>$(AssemblySearchPaths);$(ReferencePath);</AssemblySearchPaths>
    </PropertyGroup>
</Project>

Packaging

To package a build for distribution, you can run the package.ps1 PowerShell script in the root of the project. If no parameters are supplied, it will create a .zip file ready for distribution in the dist directory.

  • Linux: pwsh ./package.ps1
  • Windows: powershell -executionpolicy bypass .\package.ps1