C# Platform SDK
Currently, we provide two ways to download C# Platform SDK: NuGet and the
spatial package manager.
For normal develop environments we recommend NuGet, as it takes care of downloading dependencies and configuring your project file correctly.
For secure environments, the
spatial package manager is the only option for downloading a bundle of the DLL and XML and its dependencies together.
The easiest way to install the C# Platform SDK is via NuGet - simply add the latest version of the NuGet package
Improbable.SpatialOS.Platform to your project via your IDE.
spatial package manager
You can use the
spatial CLI tool to download a ZIP file containing the Platform SDK and its dependencies. To download to the file
spatial package retrieve platform_sdk csharp <version> CSharpPlatfromSDK.zip
Once downloaded, unzip the file and reference all DLLs. The dependencies include the C# gRPC runtime, which you can’t reference directly, but you should still include it in your project and configure it to be copied to the output folder.
Unhandled Exception: Grpc.Core.RpcException: Status(StatusCode=Unauthenticated, Detail="Getting metadata from plugin failed with error: Exception occured in metadata credentials plugin.")
This error arises because the refresh token the Platform SDK is using has either expired or is invalid. As a result, the SDK is unable to authenticate with the SpatialOS platform.
If you’re providing the refresh token either as a string or as a file, check if it’s the right string/file and if it’s still valid.
If you’re relying on the SDK reading your refresh token from the well-known location, run
spatial auth login to refresh the token.
Assembly version mismatch
If the project file is not configured correctly, you might get this error:
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Google.Apis.Auth, Version=188.8.131.52, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab'.
This occurs when one of the dependencies was compiled with a different version of an assembly that can’t be satisfied through dependency resolving.
You can fix it with either a specific assembly redirect binding or a generic tag
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> in your project file.