Introduction
ReactOS is an open source alternative to the Windows operation system. Even if the first version of ReactOS dates back to 1998, there is still no 'stable' version of ReactOS. May be, the most important reason is a lack of attention.
I want to introduce how to compile and run a first very simple C# application at the current version 0.4.7.
- Update July-2018 - ReactOS version 0.4.8: It's out since May 2018 and will be discussed here as well.
- Update November-2018 - ReactOS version 0.4.9: It's out since July 2018 and will be discussed here as well.
- Update February-2019 - ReactOS version 0.4.10: It's out since November 2018 and will be discussed here as well.
I run ReactOS on ORACLE VM VirtualBox 5.1.26 and VMWare Workstation Player 12.5.8 and strictly recommend VirtualBox - ReactOS runs much more stable on VirtualBox.
The virtual machine has been created with 2048 MByte RAM and 25 GByte HDD. The default network adapter "Intel PRO/1000 MT Desktop (8254OEM)" must be changed to "PC-net PCI II (Am79C970A)" in order to work properly.
The first installation I do is Firefox 45.0.1 or 48.0.2 (can be installed from the ReactOS Applications Manager). Immediately after installation, I open [≡]|[Options] and switch [Search]|[Search Engine] to "DuckDuckGo" (my personal affinity to search without supervision and get results not ordered by the preference of the search machine provider) as well as [Advanced]|[Update] "Automatically ..." to "Never ..." (because newer Firefox versions, e.g. 52.0.1esr, will not start on ReactOS).
Background
Unfortunately, the installations of .NET Framework 1.1 (even if it is an officially supported installation within the ReactOS 'Applications Manager') and .NET 2.0 SDK fail.
- Update July-2018 - ReactOS version 0.4.8: There is an additional message during .NET Framework 1.1 installation:
There is also an additional message during .NET Framework 2.0 installation:
- Update July-2018 - ReactOS version 0.4.9: ... and ...
- Update November-2018 - ReactOS version 0.4.9: The additional message on ReactOS version 0.4.8 during .NET Framework 1.1 installation doesn't appear on ReactOS version 0.4.9 but the installation is still not successful.
The .NET 2.0 runs through the complete setup procedure without any error message or warning. But the compilation of even the most simple C# application fails with 'fatal error CVT1103
' as for older versions of ReactOS.
This prevents installing IDEs that are based on .NET 1.1 or 2.0 (SharpDevelop 1.1 or 2.2, Visual Studio 2003 or 2005, ...).
Among the many attempts to install .NET Framework, two installations run through the complete setup procedure without any error message or warning:
- .NET Framework 2.0 SP2 redistributable 32Bit (NetFx20SP2_x86.exe 24,416kB)
- .NET Framework 4.0 redistributable 32Bit (dotNetFx40_Full_x86_x64.exe 49,268kB)
Although the installations are successful, the compilation of even the most simple C# application fails for both with 'fatal error CVT1103' (for source code, see section Using the Code at the bottom of the article). Nevertheless, the .NET 4.0 Runtime works and we need it for the following actions:
Happily, there is an escape from this limiting situation (unable to compile C# code): MONO.
The ReactOS versions 0.4.7 and 0.4.8 reports themselves as 'ReactOS [Version 5.2.3790] Service pack 2' (which is equivalent to Windows Server 2003).
The latest fully functional MONO version (a good download source is download.mono-project.com/archive), that can be installed for ReactOS version 0.4.7, is:
- MONO 3.2.3 32Bit Windows installer (mono-3.2.3-gtksharp-2.12.11-win32-0.exe 100,854kB)
This installation reports: Mono JIT compiler version 3.3.0 (which is from 2012)
Newer MONO versions, that install successfully but are not fully functional, are e.g.:
- MONO 3.12.1 32Bit Windows installer (mono-3.12.1-gtksharp-2.12.26-win32-0.msi 130,456kB)
- MONO 4.3.2 32Bit Windows installer (mono-4.3.2.467-gtksharp-2.12.30.1-win32-0.msi 130,108kB)
The MONO versions newer than 3.2.3 contain a MONO runtime (mono.exe) that cannot be executed on ReactOS version 0.4.7. All these runtimes report the same error: ERROR_BAD_EXE_FORMAT - mono.exe is not a valid Win32 application.
Consequently, I recommend to install MONO 3.2.3. Since MONO 3.2.3 installs to C:\Program Files\Mono-3.2.3 and the MONO versions newer than 3.2.3 install to C:\Program Files\Mono, MONO 3.2.3 - a newer version can be installed in parallel as well. This provides the opportunity to test newer assemblies from case to case.
- Update July-2018 - ReactOS version 0.4.8: On ReactOS version 0.4.8 fully functional MONO version, I've tested, are:
- MONO 3.2.3 32Bit Windows installer (mono-3.2.3-gtksharp-2.12.11-win32-0.exe 100,854kB)
This installation reports: Mono JIT compiler version 3.3.0 (which is from 2012) - MONO 3.12.1 32Bit Windows installer (mono-3.12.1-gtksharp-2.12.26-win32-0.msi 130,456kB)
This installation reports: Mono JIT compiler version 3.12.1 (which is from 2014) - MONO 4.0.1 32Bit Windows installer (mono-4.0.1-gtksharp-2.12.26-win32-0.msi 118,800kB)
This installation reports: Mono JIT compiler version 4.0.1 (which is from 2014) - MONO 4.0.2 32Bit Windows installer (mono-4.0.2-gtksharp-2.12.26-win32-0.msi 118,820kB)
This installation reports: Mono JIT compiler version 4.0.2 (which is from 2014) - MONO 4.0.3 32Bit Windows installer (mono-4.0.3-gtksharp-2.12.26-win32-0.msi 117,720kB)
This installation reports: Mono JIT compiler version 4.0.3 (which is from 2014)
Newer MONO versions, that install successfully but are not fully functional (mcs.exe compiler works, but mono.exe runtime doesn't), are e.g.:
- MONO 4.2.1 32Bit Windows installer (mono-4.2.1.124-gtksharp-2.12.30-win32-0.msi 121,564kB)
- MONO 4.3.2 32Bit Windows installer (mono-4.3.2.467-gtksharp-2.12.30.1-win32-0.msi 130,108kB)
The MONO versions newer than 4.0.3 contain a MONO runtime (mono.exe) that cannot be executed on ReactOS version 0.4.8. The MONO versions 4.2.1 and 4.3.2 report the same error: The procedure entry point InitializeConditionVariable could not be located in the dynamic link library KERNEL32.dll.
Consequently, I recommend to install MONO 4.0.3. It installs to C:\Program Files\Mono.
- Update November-2018 - ReactOS version 0.4.9: ... and ...
- Update February-2019 - ReactOS version 0.4.10: The mono.exe runtime works fine now installed from versions MONO 4.2.1 32Bit and MONO 4.3.2 32Bit.
Consequently, I recommend to install MONO 4.3.2. It installs to C:\Program Files\Mono.
All versions, I can recommend (MONO 4.0.3 32Bit on ReactOS 0.4.7/8 and MONO 4.3.2 32Bit in ReactOS 0.4.9/10, report themselves as:
Environment Version: 4.0.30319.1
Even newer versions than MONO 4.3.2 require Vista (NT 6.0) at least.
Although all mentioned setups up to MONO 4.0.3 32Bit (on ReactOS 0.4.7/8) or MONO 4.3.2 32Bit (on ReactOS 0.4.9/10) run through the complete setup procedure without any error message or warning, they do not install Gtk# correctly.
This becomes obvious, if a separate Gtk# installation is made. All gtk-sharp-2.12.xx.msi setups (a good download source is www.npackd.org/p/gtksharp, that currently provide gtk-sharp versions 2.12.20 to 2.12.45) report the same error: The procedure entry point if_nametoindex could not be located in the dynamic link library IPHLPAPI.DLL. (Only the gtk-sharp-2.99.3.msi setup doesn't report this error, but it installs the Gtk# 3 preview.)
The incomplete installation of Gtk# 2.12.9 or higher (required for MonoDevelop-2.8.6.5.msi) prevents using MonoDevelop. Since none of the professional C# IDEs (SharpDevelop, Visual Studio, MonoDevelop) run on ReactOS 0.4.7, 0.4.8 and 0.4.9, I fall back to Notepad++ (version 6.9 can be installed from the ReactOS Applications Manager). After a plug in Manager update, the NppExec
plugin can be installed.
Using the Code
A very simple C# application shall be used to demonstrate the general operational capability.
using System;
using System.Reflection;
namespace ConsoleApp01
{
public class ConsoleApp01
{
public static void Main(string[] args)
{
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("Hello from ReactOS on " + Environment.MachineName + "!");
Console.WriteLine("OS Version: " + Environment.OSVersion);
Console.WriteLine("Image runtime Version: " +
Assembly.GetExecutingAssembly().ImageRuntimeVersion.ToString());
Console.WriteLine("Environment Version: " + Environment.Version.ToString());
Console.WriteLine("Setup information: " + AppDomain.CurrentDomain.SetupInformation);
Console.WriteLine("");
Console.Write("Press any key to continue...");
Console.ReadKey();
}
}
}
As a first step, I recommend to check/extend the Path
variable. It can be edited via Start | Settings | Control Panel | System | Advanced | Environment Variables and should include ";C:\Program Files\Mono-3.2.3\bin;C:\Program Files\GtkSharp\2.12\bin" for MONO 3.2.3 or ";C:\Program Files\Mono\bin;C:\Program Files\GtkSharp\2.12\bin" for MONO 3.12.1 or higher.
As a second step, I recommend to create a working folder C:\Documents and Settings\<user>\My Documents\.NET Apps, a project folder ConsoleApp01 and the source code file ConsoleApp01.cs.
Within the Notepad++ (with NppExec
plugin installed), the [F6] key opens the command window, where new command scripts can be created and saved as well as command scripts started. The command script I use is:
NPP_SAVE
CD $(CURRENT_DIRECTORY)
C:\Program Files\Mono\lib\mono\4.5\mcs.exe "$(FILE_NAME)"
- Update November-2018 - ReactOS version 0.4.9: Compilation might fail. I've got his error:
Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'mcs, Version=4.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. File is corrupt. (Exception from HRESULT: 0x8013110E) ---> System.BadImageFormatException: File is corrupt. (Exception from HRESULT: 0x8013110E)<br /> --- End of inner exception stack trace ---
This indicates a failed MONO installation. In this case, MONO should be uninstalled, the MONO installation folder should be deleted (or cleaned and renamed, if deletion fails due to file system errors) and MONO should be installed again. In my case, many files of the MONO installation either have not been installed or have corrupt file information. I can recommend to start ReactOS in debug mode to repair corrupt file information (even if the files are not repaired and must be installed again).
The resulting application, executed with the MONO runtime, produces this output:
Hello from ReactOS on REACTOS-047!
OS Version: Microsoft Windows NT 5.2.3790.131072 Service Pack 2
Image runtime Version: v4.0.30319
Environment Version: 4.0.30319.17020
Setup information: System.AppDomainSetup
Press any key to continue...
The resulting application, executed with the Microsoft .NET 4.0 runtime, produces this output:
Hello from ReactOS on REACTOS-047!
OS Version: Microsoft Windows NT 5.2.3790 Service Pack 2
Image runtime Version: v4.0.30319
Environment Version: 4.0.30319.1
Setup information: System.AppDomainSetup
Press any key to continue...
Points of Interest
Although there are a lot of pitfalls and restrictions, it is possible to compile and run .NET applications on ReactOS.
History
- 23rd December, 2017: Initial tip
- 1st January, 2018: There is a follow-up article: Introduction to System.Windows.Forms on ReactOS with C#
- 11th July, 2018: Update 1, that adds ReactOS 0.4.8 enhancements
- 23th November, 2018: Update 2, that adds ReactOS 0.4.9 enhancements
- 20th February, 2019: Update 3, that adds ReactOS 0.4.10 enhancements