Get SpatialOS

Sites

Menu
You are viewing the docs for 11.0, an old version of SpatialOS. 12.0 is the newest →

Building

The default build for the C# worker sets up a project that should get you started quickly, lets you customize the build, and is upgradeable between SpatialOS versions. However, if you need to customize it further, you can turn off the automatic build script generation.

IDE support

After running spatial worker build for the first time, a .sln file, which can be loaded in your IDE, should appear. Note that, by default, this file will be overwritten every time a build is run. It is compatible and has been tested with Visual Studio 2015 Community Edition, and is known to work with Jetbrains’ Rider early access preview, except for running a worker from within the editor. The default solution currently isn’t compatible with MonoDevelop and Xamarin. If you wish to customize the solution and project files to make them compatible with your IDE, please follow the instructions on how to customize the build by turning off automatic build script generation as shown above.

Project setup

The project is set up to have two configurations - Release and Debug - and 3 platforms for each - Windows64, Linux64, and macOS64, which build assemblies for 64-bit Windows, Linux, and macOS respectively. These assemblies are bundled from the target directories of the build, so if you wish to have additional resources statically available at runtime, you can put them in the target directory of the relevant configuration-platform. Each of the assemblies will contain compiled native code dependencies required to run the worker on the given platform. 32-bit versions of native dependencies are currently not provided.

When you run spatial worker build, this code will be generated for your schema. This is then compiled as a separate assembly, as it needs to use the unsafe keyword. Release builds and assemblies for all provided platforms will be built.

You can also open the CsharpWorker solution in an editor of your choice, and build your code from there. Schema changes should be automatically picked up when building from an editor. You will have to run spatial worker build after an upgrade of SpatialOS to pick up the newest dependencies.

Source control setup

We recommend to add some files and directories to the list of ignored items in your source control system. Apart from the usual suggested ignored C# project files (see an example .gitignore), you might want to add improbable/ and spatial.log. If you are using the default build scripts, you might also want to add spatialos.csharp.build.json, BuildTargets.targets, CsharpWorker.sln, CSharpWorker.targets, GeneratedCode.csproj, and spatialos_worker_packages.json.

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums