C# Language Tutorial

Find Tips and tricks on how to better use the Zeus IDE. Feel free to post your own tips but please do not post bug reports, feature requests or questions here.
Post Reply
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

C# Language Tutorial

Post by jussij »

To use Zeus to compile and run C# programs you first need to make sure the C# compiler (i.e. csc.exe) is installed and in the system path.

One way to get the C# compiler is to install the .NET SDK found here: https://www.microsoft.com/en-us/downloa ... x?id=53321

Use Zeus to write the C# code and then use the Zeus Compiler, Compile menu to compile that code to produce and executable.

Then use the Macros, Execute menu to run the resulting executable.

As an example create the test.cs file shown below:

Code: Select all

class Test
{
    static void Main()
    {
        Console.WriteLine("Hello World!");
    }
}
Compiling this code should result in the following compiler output:

Code: Select all

Using document type compiler options....

Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.

test.cs(5,9): error CS0103: The name 'Console' does not exist in the current context
The error can be fixed by adding the using System line of code shown below:

Code: Select all

using System;

class Test
{
    static void Main()
    {
        Console.WriteLine("Hello World!");
    }
}
By recompiling the code this time a test.exe will being created ;)

Now run that executable using the Macros, Execute menu and the output will be captured inside Zeus.

Note: The latest version of Zeus can directly import and build Visual Studion solution files so this tip is now obsolete, but it remains as an alternative option ;)

Additional Information:
Using Zeus with C# .Net Core
Using Zeus with Microsoft Tools
Working with the C# 2.0 Command Line Compiler

Cheers Jussi
Post Reply