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 the Command Line
Open a Terminal window (Command Prompt, PowerShell, or your preferred terminal).
Navigate to where you want to create your project.
Run:
dotnet new mdk2pbscript -n MyFirstScript -o MyFirstScriptReplace
MyFirstScriptwith your desired project name.
Option 2: Using MDK Hub
Click "New Project" in the Hub dashboard and let it create the project for you.
Opening the Project in VSCode
Open VSCode.
Close any welcome dialogs.
Drag your project folder into VSCode (or use
File→Open Folder).If prompted, install the C# Dev Kit extension:
This extension provides IntelliSense, debugging, and build support for C# projects.
Building Your Script
- Make your code changes in
Program.csor add new.csfiles as needed. - Build the project:
- Press
Ctrl+Shift+B(orCmd+Shift+Bon Mac) - Or open the terminal and run:
dotnet build
- Press
- 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