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.
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.
The project is set up to have two configurations -
Debug - and 3 platforms for each -
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
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
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
spatial.log. If you are using the default build scripts, you might also want to