WARD.NU
Return to WWW.WARD.NU
Compiling .NET CF (Pocket PC) applications without Visual Studio.NET
Last updated 20030526 - I was recently notified of the link http://msmobiles.com/article.php/35.html. This page also shows this procedure, written in the same timespan. Although Microsoft insists (see usenet) that you can not compile .NET Compact Framework (.NET CF) applications without owning Visual Studio .NET, it is in fact possible. Applications for the normal .NET Framework can be compiled using the free .NET SDK. When you compile .NET CF applications, you need to reference different "assemblies". Those assemblies are not included in the .NET SDK, and can not be downloaded separately from the Microsoft website. Or can they?
Obtaining the necessary files
You need to download the following files: Install the .NET SDK. Afterwards, install the .NET Compact Framework. Navigate to the directory where you have installed your .NET CF. You will find a file named "netcf.core.ppc3.arm.cab". Open this file using explorer and extract all the files into a separate directory. These are the files you need, you just need to rename them to the proper names, according to this table:
filename action NE8A18~1.000 remove 0mscoree.001 remove MSCORE~1.002 remove cgacutil.003 remove NETCF1~1.004 remove NETCFA~1.005 remove CALEND~1.006 remove CHARIN~1.007 remove CULTUR~1.008 remove CULTUR~2.009 remove REGION~1.010 remove mscorlib.011 rename to mscorlib.dll 00system.012 rename to system.dll SYD8C9~1.013 rename to system.drawing.dll SY17B8~1.014 rename to system.web.services.dll SY5DD4~1.015 rename to system.windows.forms.dll SY9B57~1.016 rename to system.windows.forms.datagrid.dll SY40C7~1.017 rename to system.xml.dll SYB769~1.018 rename to system.net.irda.dll SYSTEM~2.019 rename to system.data.dll MICROS~2.020 rename to microsoft.visualbasic.dll MICROS~3.021 rename to microsoft.windowsce.forms.dll NETCF_~1.999 remove
Alternatively, you can download the batch file convertnet.bat to do this step for you.
Compiling an application
Now you have everything you need. Open a Command Prompt and execute the file "sdkvars.bat" in the \BIN directory of your .NET SDK directory.
Now you can compile any .NET CF compliant source code. Please notice: most of the examples in the .NET Framework SDK will not compile without altering some of the source code.
To compile a .NET CF application, execute the following command (substitute d:\net\cf\dll in the directory where you have extracted the .CAB file):
csc /noconfig /nostdlib /r:d:\net\cf\dll\mscorlib.dll /r:d:\net\cf\dll\system.dll
/r:d:\net\cf\dll\system.drawing.dll /r:d:\net\cf\dll\system.windows.forms.dll
HelloWorld.cs
Compiling a sample application
As an example, we'll compile my Teletekst application.
Extract the referenced zip file into a new directory.
To compile, execute the following command (substitute d:\net\cf\dll in the directory where you have extracted the .CAB file):
csc /noconfig /nostdlib /r:d:\net\cf\dll\mscorlib.dll /r:d:\net\cf\dll\system.dll
/r:d:\net\cf\dll\system.drawing.dll /r:d:\net\cf\dll\system.windows.forms.dll
/target:winexe /out:nosttnet.exe /win32icon:Teletekst.ico
/resource:Teletekst.resources Teletekst.cs
For more information regarding this application, visit this page.
Hints