Prerequisites
Note
Before following this guide, make sure you've installed and set up MDK Hub. The Hub handles .NET SDK installation, template setup, and project management for you.
Creating a New Project
Option 1: Using Rider's Template UI
Open JetBrains Rider.
Click "New Solution".
In the template list, find and select "Programmable Block Script (MDK2)".
Choose a name and location for your project, then click "Create".
Option 2: Using the Command Line
Open a terminal and run:
dotnet new mdk2pbscript -n MyFirstScript -o MyFirstScript
Then open the project in Rider.
Option 3: Using MDK Hub
Click "New Project" in the Hub dashboard and let it create the project for you, then open it in Rider.
Note
Make sure you select the Script project template, not the Mixin project. Mixin projects are for advanced shared code libraries.
Building Your Script
- Make your code changes in
Program.csor add new.csfiles as needed. - Build the project (
Ctrl+Shift+F9orBuild→Build Solution). - MDK will automatically:
- Combine all your
.csfiles into a single script - Apply minification (if configured)
- Deploy the script to your Space Engineers IngameScripts folder
- Show a notification when complete (if Hub is running)
- Combine all your
Your compiled script will be available in Space Engineers under Programmable Block → Edit → Browse Scripts (the folder icon).
Next Steps
- Configure your project - Adjust minification levels, ignore patterns, and more
- Control file order - Manage how your files are combined
- Preserve code during minification - Keep specific types/methods unminified
Note
A big thank you to @Drew-Chase who contributed to the Rider documentation.