Using the Visual Studio .NET IDE is by far the easiest way to develop .NET applications, but it is certainly not the only way. The .NET Runtime ships with the compilers for C#, VB .NET, and VJ# as part of the runtime itself, so as long as you have a text editor and the .NET Runtime, you can create any .NET applications you want. Construction Cue
Open up your favorite text editor (Notepad, for instance) and enter the code from one of the previous listings, depending on your language preference. After you have written the code, save it and open up a command prompt. Before you can actually use the compilers that are part of the .NET Runtime, you will need to set your path to point to the location of the underlying .NET Framework. In your command window, enter the following command to update your path: set path=%path%;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 Caution
The command-line compilers are located in the folder listed here, along with the assemblies that comprise the .NET Runtime itself. The C# compiler is found in the csc.exe, and the VB .NET compiler is found in vbc.exe. Each of these executables takes a similar set of command-line arguments, and you can use a single argument of /? to display the list of all arguments for each of these compilers. Assuming you used the C# version of the code and saved the file as class1.cs, you can do the following to compile the application to an executable named app.exe. First navigate to the folder where your code file was stored and then run the following command: csc /out:app.exe /target:exe Class1.cs The output should be similar to the following: Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4 for Microsoft (R) .NET Framework version 1.1.4322 Copyright (C) Microsoft Corporation 2001-2002. All rights reserved. Running the application now produces the exact same output you saw when using the IDE as your development environment. |