|
| 1 | +# Building Open Rails |
| 2 | + |
| 3 | +This document will take you through the steps needed to build Open Rails from the source code and to run and start debugging it. |
| 4 | + |
| 5 | +Line ending in two spaces. |
| 6 | + |
| 7 | +dummy line |
| 8 | + |
| 9 | +Line ending in br.<br/> |
| 10 | + |
| 11 | +dummy line |
| 12 | + |
| 13 | +Line ending in pspace/p.<p> </p> |
| 14 | + |
| 15 | +dummy line |
| 16 | + |
| 17 | +Line ending in p/p.<p></p> |
| 18 | + |
| 19 | +dummy line |
| 20 | + |
| 21 | + |
| 22 | +## Overview |
| 23 | + |
| 24 | +To work with the code, you will need an installation of Microsoft Visual Studio and also content that is standalone (doesn't rely on sharing files from 3rd parties). |
| 25 | + |
| 26 | +Visual Studio provides the Git tools to clone the Open Rails repository and submit your changes as a pull request. |
| 27 | + |
| 28 | +Any new features will also require matching changes to the Open Rails Manual, so a Docker container is provided that works with Visual Studio Code to build the manual in either HTML or PDF. |
| 29 | + |
| 30 | +## Windows |
| 31 | + |
| 32 | +Use any Windows from version 7 with Service Pack 1 upwards. Open Rails can also be developed on a virtual machine. |
| 33 | + |
| 34 | +## Visual Studio |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | +Download and install Visual Studio 2019 Community Edition from Microsoft. |
| 39 | +(Other editions will work but this one is free. Version 2022 will also work, but this is reported as significantly slower. Version 2017 is not recommended as in Feb 2022 we are moving towards .Net 5 which is incompatible.) |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +### VS Installation |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +The only "workload" needed is .NET desktop development. Some optional tools which may be useful are also checked. |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +You don't have to create an Microsoft account for 2019, but there is little downside. |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +### Open Rails Repository |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | +You will be prompted to "Get started" and should "Clone a repository" from |
| 64 | +[https://github.com/openrails/openrails.git](https://github.com/openrails/openrails.git) |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +On completion, the Solution Explorer view will list the solution ORTS.sln. Pick it to receive a prompt: |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | +The purpose of the Launcher project is to check whether the user's PC has the software libraries installed to run Open Rails. It uses libraries which are installed on even old PCs, so that it can run on them without error and report any problems. |
| 75 | + |
| 76 | +However the framework needed to build that project is not installed automatically, so choose the option highlighted in the image above. |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +Finally we get to see a list of the projects in the Open Rails solution. |
| 81 | + |
| 82 | +Note: There is no project called OpenRails. Instead, the Launcher project builds an executable called OpenRails.exe. |
| 83 | + |
| 84 | +## Compiling |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +Use Build > Rebuild Solution to compile and link the source code into executable and DLL files. |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +Initially, your local repository contrains an empty folder Programs. The executable files just created are saved in this folder. |
| 93 | + |
| 94 | +## Executing |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | +At this point you can switch to the Windows File Explorer or the command line and run OpenRails.exe. This will carry out some checks and then run Menu.exe. |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | +When debugging, it will be easier to start the program from within Visual Studio. First, set the desired project to be the Startup Project which will run when you press Debug > Start Debugging. |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | +Now pressing F5, Start or Debug > Start Debugging will launch the project Menu.exe in debugging mode. |
| 107 | + |
| 108 | +## Content |
| 109 | + |
| 110 | +Without content, all you can run is Menu.exe (or OpenRails.exe which runs Menu.exe) and some of the contributed tools. |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +The easiest content to install is [Demo Model 1](http://openrails.org/download/content/). |
| 115 | +Another recommendation is the [test track from Coals To Newcastle](9https://www.coalstonewcastle.com.au/physics/route/) as its small size makes it quick to load and it is designed for testing. |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | +Unzip into a new folder. |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | +Start Open Rails Menu.exe, and use Options > Content > Add to add the folder "Demo Model 1" to the list of installation profiles. |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | +Select Demo model 1 as the Installation profile. |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | +Pressing Start will run the simulation program RunActivity.exe. You can also run this from the command line by providing appropriate arguments. If you hold down the Alt key while pressing the Start button, these arguments are copied into the Windows paste buffer. |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | +From Visual Studio, using Project > Properties > Debug > Command line arguments, these arguments can be pasted into the RunActivity project. If this is the set to be the Startup Project for the solution, pressing F5 will launch RunActivity.exe on the selected activity with debugging in place. |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | +## Installing Tools for Open Rails Manual |
| 140 | + |
| 141 | +## Submitting Changes |
0 commit comments