Pocket C# home | download | documentation | about

Installation

First of all make sure you have .NET CF itself installed. It's already preinstalled in WM2003 devices, otherwise download it now.

If you are installing Pocket C# for the first time, download it and console tools from download section. After this unzip console.zip and install two .cab files located inside (just copy them do device and "run").

Then unzip pcsharp.zip and install pcsharp.arm.cab same way. Note: you can install PC# to any folder but in any case \pc# folder will be created with samples and I recommend to use it for your projects too; btw, path to source and output file currently can't contain spaces.

To verify that you did everything correctly, "run" \pc#\samp\gui\gui.csant file using file manager. Console window will open and sample application compiled, you can then run gui.exe and see simple GUI application. Same for \pc#\samp\cons - simple console app and other sample applications.


Usage
Writing sources

You can use any text editor that allows to open/save files with any extensions to write source code. I recommend Tillanosoft PocketNotepad with their tGetFile.dll. I hope I'll have enough free time to make IDE with many useful features soon.


Project files

To make build process really simple project file is used, it's something like Makefile but in XML format and with .csant extension. During installation these files registered to be opened by csant build tool. So when you "run" such file using any file manager, console window is opened, neccessary actions performed and you see output messages. Only modified files are recompiled so build process takes less time.

Simple .csant file has following structure (note that you always have to specify full file names with path and use forward slashes):

<?xml version="1.0"?>
<project name="gui" default="all">
    <property name="out" value="/pc#/samp/gui/gui.exe"/>
    <target name="all">
        <cscc output="${out}">
            <arg value="-L/pc#/lib -winforms"/>
            <sources basedir="/pc#/samp/gui">
                <includes name="gui.cs"/>
            </sources>
        </compile>
    </target>

    <target name="clean">
        <delete file="${out}"/>
    </target>
</project>
				

This file defines project named gui with two targets: all and clean. Property out defined with name of project output file (of course project may have many output files). Target clean contans one action that deletes output file. Target all is default for this project and contains action to build application. Tag arg defines arguments passed to C# compiler: one to tell where libraries located and another to tell that we need to link with Forms assembly. Then list of source files defined with base path and one file.

Full documentation on XML build file syntax can be found here.


Command line usage

Open console by running CMD program. After that you must set PATH environment variable to where you installed PC#. To do this execute 'set path=\pc#' command (you have to repeate this each time you open new console window). Remember that as in project files you must specify full path in program arguments. Following tools are available (not all arguments listed, you can always view them with --help switch):

cscc-cs, ilasm, ilalink - C# compiler, IL assembler and linker.


cscc - Wrapper for three above tools. Calls them with appropriate arguments to generate specified output file from sources. Normally (but w/o project files) you should use this tool and not manually call lower-level ones.

Usage: cscc <options> -o <outfile> <sources>

<outfile> - name of final output file

<sources> - list of source files, wildcards allowed

<options> is combination of:

   -winforms - link with System.Windows.Forms libraries, needed for GUI applications


csant - Build tool. Processes project files with format as described above and performs needed actions. In most cases you will want to create project file to make build process much easier instead of using any other tools manually.

Usage: csant -f <file> <target>

<file> - project file to use

<target> - target to build; if not specified, default project target will be used


Users Group

There are Pocket GCC group at Yahoo! Groups. Join it to get notified about new versions right after they are available for download as well as about my future plans and other important information, to discuss PC#-related topics, share files and so on. Group address is http://groups.yahoo.com/group/pcsharp.


Samples
Distribution contains four sample programs - con - console application, gui - with GUI, SliderPuzzle - well-known '15' puzzle and WebCrawler - demonstrates how to add resources (eg. images) to application (both from MS CompactFramework SDK samples).