|
Instructions for downloading and installing the .NET Framework and .NET Framework SDKThe C# compiler, which is required to compile C# programs, is included in a software package named .NET Framework SDK (Software Development Kit). In order to run on a computer, the .NET Framework SDK requires a separate software package named .NET Framework. Thus, you must first install the .NET Framework and then install the .NET Framework SDK to get the C# compiler to your computer.Microsoft provides both old and new versions of the .NET Framework SDK. The programs in A Natural Introduction to Computer Programming with C# can be compiled also with the old versions of the .NET Framework. The following paragraphs explain how the .NET Framework SDK version 1.1 can be taken into use. If you want to use a newer version, you should download and install newer files. You can download both the .NET Framework and .NET Framework SDK via the Internet address http:/msdn.microsoft.com/netframework/ Before you click the above address and go to the Microsoft's pages, you should have a folder (directory) on your computer into which you download the installation files. I'm supposing here that D:\setupfiles is the folder into which the downloaded files are put. When you go to the above Microsoft's page, you should find two items to download. These are called After you have downloaded the files dotnetfx.exe and setup.exe from Microsoft, you can start the installations. The .NET Framework must be installed before the .NET Framework SDK, i.e., you must execute the file dotnetfx.exe before setup.exe. The installations are described below. Select My Computer > Local Disk D: > setupfiles > dotnetfx.exe By double-cliking the file name dotnetfx.exe you can execute the file. You will be asked: "Would you like to install Microsoft .NET Framework 1.1 Package?" Click Yes. A Licence Agreement will be displayed. If you accept the Licence Agreement, select "I agree", and click Install. The installation takes something like 5 minutes or less, depending on the speed of your computer. Click OK when the installation programs says "Installation
of Microsoft .NET Framework 1.1 is complete."
Select My Computer > Local Disk D: > setupfiles > setup.exe You will be asked: "Would you like to install Microsoft .NET Framework SDK Package?" Click Yes. You will see a window which says "Welcome to the .NET
Framework
A Licence Agreement will be displayed. If you accept the Licence Agreement, select "I agree", and click Next. You will be displayed an Installation Options window. Click Next. Then you'll see the Destination Folder window in which
you can select the folder into which most of the files of the .NET Framework
SDK will be installed. If you have both C: and D: hard disk drives in your
computer, and there is plenty of disk space on disk D:, it is better to
select a folder on disk D: Thus you can click Browse and write D:\msnetsdk
to the Select Path field. This way the files will be installed in
a folder named msnetsdk on Local Disk D: (Drive D:).
After you have clicked Next, the installation begins and you'll be displayed the Installing Components window. That window tells how much time the installation of various components takes, but those time amounts are not accurate. The installation took 15 minutes on my computer. It can be slower or faster on your computer. When the installation is complete, you'll see a window
which says: "Installation of Microsoft .NET Framework SDK 1.1 (English)
is
If you explore your computer after the installation, you'll
find out
MAKING THE C# COMPILER OPERATIONALThe free C# compiler that comes with the .NET Framework SDK is a compiler that can be used from the command line. This means that you must invoke the compiler by giving a command in a commmand prompt window. (Read the book to find more information about the command prompt window.) The compiler can be invoked by writing a command like csc Test.cs but this command does not work unless you have told the Windows operating system where the compiler csc is located. The main program of the C# compiler is located in a file named csc.exe, and you must "explain" to the Windows operating system where this file can be found. One way to tell the Windows opeating system where the csc.exe is located is to give a new value to the PATH environment variable. The PATH variable specifies the search path that is used to seach for programs that are invoked from the command line. The PATH variable can be set as follows. (Note that it is possible to paste text to the Variable value: field with the right mouse button.)First you have to activate the Control Panel through which
you can control your computer.
With the above operations you tell the Windows operating system that the csc.exe file is in a folder named v1.1.4322 that is in folder Framework which is in folder Microsoft.NET which in turn is in the WINDOWS folder in drive C: The folder name v1.1.4322 indicates that the .NET Framework version in question is 1.1 and the build number is 4322. It is likely that the build number is different when you download the .NET Framework programs. Before setting the PATH variable, explore your computer and check the exact name of the folder that has been created during the installation. When you have set the PATH variable, you should open a new command prompt window to check whether your C# compiler works. You should see the following output in the command prompt window when you try to compile a non-existent C# program named Test.cs D:\>csc Test.cs
error CS2001: Source file 'Test.cs' could not be found
You may need to have administrative rights in order to set the PATH variable. According to my tests, the programs of my C# book can be succesfully compiled when the PATH variable is set as described above. If you encounter problems while using the C# compiler or other .NET tools, you should set the environment variables as described below. If you could not set the value of the PATH variable, or you do not want to change it, there is an alternative way to make the installed C# compiler operational. The alternative is to give the command msnetsdk\v1.1\bin\sdkvars in a command prompt window. After the above command is
given, certain environment variables are set, and the C# compiler should
work as long as the command prompt window is not closed. When a new command
prompt window is opened, the above command must be given again. The above
command executes a batch file named sdkvars.bat. A batch file contains
a set of readable MS-DOS commands which are executed when the file is executed.
WHEN NOTHING SEEMS TO WORKI have written all the C# programs that you’ll find in the book by using the .NET Framework SDK Version 1.0, the first version of the software package. If you encounter problems while installing a later version of the development kit, you could try installing the first version, which might still available on the Microsoft Internet pages. When I installed the .NET Framework SDK Version 1.0, it was easy to install because all you had to do was to execute a single installation program (setup.exe). The installation program installed both the .NET Framework and the .NET Framework SDK, and it automatically set the Path environment variable so that the C# compiler can be activated from the command prompt window.If you cannot do the installations that are explained
on this page, you might try to install a free version of the Microsoft
Visual Studio.
|