C# Language Tutorial

Find Tips and tricks on how to better use the Zeus editor. 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: 2471
Joined: Fri Aug 13, 2004 5:10 pm

C# Language Tutorial

Post by jussij » Sun Aug 12, 2007 11:28 pm

NOTE: This topic is only of historical interest since the current version of Zeus supports the Microsoft C# compiler out of the box.

To use Zeus with C# just make sure the C# compiler is installed and the csc.exe is found in the PATH environment variable.

The older post is found below:

Microsoft provides the following batch file to set up the C# environment variables:
Directory of c:\Program Files\Microsoft Visual Studio 8\Common7\Tools

19/07/2007 13:52 1,882 vsvars32.bat
Before you can run the csc.exe these environment variables will need to be defined.

You can use the control panel to setup these environment variables or alternatively you can create a simple batch file.

Just create the following csc.cmd batch file:

Code: Select all

@echo off
rem Setup the environment variables
call "c:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"

rem Run the compiler (define your own command line here)
csc.exe /debug /r:System.dll; %1
Make sure the file is in the Zeus install directory as follows:

Code: Select all

c:\Program Files\Zeus\csc.cmd
Now you can edit the C# Document Type and set the Compiler Options to be:

Code: Select all

csc.cmd "$fn"
To test the configuration create a c:\temp\test.cs test file as follows:

Code: Select all

class Test
{
    static void Main()
    {
        Console.WriteLine("Hello World!");
    }
}
Which when compiled 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

Unexpected error running command line:
cmd.exe /c csc.exe "c:\temp\test.cs" 
The error can be fixed by adding the using System line of code:

Code: Select all

using System;

class Test
{
    static void Main()
    {
        Console.WriteLine("Hello World!");
    }
}
and by running the compile again a test.exe will being created ;)

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 Microsoft Tools
Working with the C# 2.0 Command Line Compiler

Cheers Jussi

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: No registered users and 1 guest