menu
info Documentation

Development Environment

D2S2 scripts and custom models can be created using a C# environment within Visual Studio Code (VSCode).

Setup VSCode for D2S2 Development

The steps below is similar to that which are described in the Getting Started Guide for C# in VSCode.

  • Download Visual Studio Code and install.
  • After opening VSCode go to Extensions and search for C# Dev Kit.
  • Install this extension - it should automatically also add the C# and .NET Install Tool extentions.
  • When prompted that a .NET SDK is not present - it is necessary to install through it from here. It is suggested that you make use of the x64 version.
  • To test whether the SDK is correctly installed check whether the dotnet command is known by opening the terminal of your system and type dotnet --help. If your system does not recognise this command you need to add this to your environmental variables.
    • To add this to your environmental variables go to your File Browser and navigate to This PC. Right-click in the window and select Properties, and then in the new window go to Advanced system settings and then select Environmental Variables...
    • Under the Path variable, select Edit and add the location to the dotnet command which should be default be installed at C:\Program Files\dotnet

Create a New D2S2 Development Project

To effectively develop code that interacts and use the D2S2 infrastructure, the development code should be aware of the D2S2 libraries and D2S2 should be aware of the location of the user-defined code.

  • Open up D2S2 and select the User Settings option.

  • In the new window select Developer option, where a number of new fields should appear in the panel to the right (see Figure 1).

Figure 1: The Developer settings panel within the user settings.

  • To define a new development folder or select a folder that already contains custom modules, follow the folder prompt in the Source Directories panel. After a new development folder has been setup by D2S2, there should now be a .csproject file within the folder which links to the necessary D2S2 libraries.
  • This folder can now be opened with VSCode that should identify it as a C# project.
  • A new class file can now be created in this folder to insert the required user defined-capabilities.
  • After a file change within the development folders, D2S2 will attempt to compile the new source. Errors in the compilation is depicted and presented in the bottom panel of the Model View panel, see Figure 2.

Figure 2: Error list within the Model View panel.