Building FreeTrain

How to compile from source

The source code is hosted on SourceForge, so please download it from there.

There are instructions on the FreeTrain project page on how to fetch the source code repository.

Also, in the case you are just browsing the code, you can use the browse SVN feature.

The build should succeed by just opening the sln file. There are at the time of writing (2003-01-18) no reports that the source fails to build.

Let’s work together to create an even better FreeTrain!

How to work with SharpDevelop

The recommended development environment for FreeTrain is SharpDevelop, a Free and open source full-featured IDE for Windows.
Target OS:Windows 2000/XP

1. Install the .NET Framework 2.0 Redistributable package

This is the runtime environment and is needed to run FreeTrain. Download from Microsoft and install.

2. Install the .NET Framework 2.0 SDK

This is the development environment. Download from Microsoft and install.

3. Install SharpDevelop

It’s time to install SharpDevelop. The recommended version is 2.1. For details on how to install SharpDevelop, see the official website.

4. Download the source files

It’s now time to obtain the source files from SourceForge. Right now, the only way to access these files is through Subversion (SVN). If you don’t know anything about SVN, there are detailed instructions on SourceForge. A popular SVN tool for Windows is TortoiseSVN.

Put the source file suite in an appropriate directory on your hard drive.

5. Import the project

Start SharpDevelop and from the Start Page click on ‘Open solution’, then select ‘freetrain.sln’ from the root directory you just created. All C# code will import cleanly, but the C++ code will fail with an error. For now, just ignore that and proceed.

6. Reference settings

By following the steps above, you will be able to open the project. However, the build will fail with errors in various places.

The correction steps below are applicable for my environment and might or might not work for everyone. [NOTE: The steps below are deprecated. To build recent code successfully with #develop, simply remove the DirectDraw.AlphaBlend, DirectDraw.VideoRecorder, and FreeTrain.VCR projects from the solution.]

  • In the project reference, add COM control ActiveMovie control typelibrary and DirectX 8 for Visual Basic Type Library
  • In the project reference, remove empty references
  • In the project reference, add COM control DirectX 7 for Visual Basic Type Library
  • In the project reference, add Interop.DirectDrawAlpha.dll from the .NET assembly browser (available in lib/
  • In the FreeTrain.VCR project, add ActiveMovie control typelibrary

When you build now, you will get errors about duplicate files, so resolve the file conflicts before proceeding again.

Note: this is an edited translation of the Japanese wiki page.