Practical C # (1)

zhaozj2021-02-08  260

C # Practical? Can we transfer the development platform to C #? Software developed with C #, can you run directly under Windows98, Windows2000, XP?

How to run? Let us try it.

1. Use C # to compile a simplest console program:

Using system;

Namespace consoleapplication1 {class class1 {[stathread] static void main (String [] args) {system.console.write ("Hello World.");}}}

Build passes, generate consoleapplication1.exe, only 5kb. Operating normally.

Environment: Installing the Windows2000 for VS.NET.

2. Is this EXE file that can be run directly under Windows98?

Analyze this EXE file and find it to use Mscoree.dll, so

Copy c: /winnt/system32/mscoree.dll

This DLL file is only 128kb. If you take such a DLL, you can run the C # compiled in Windows98, and it is not bad.

Start with Windows98, run consoleapplication1.exe, error:

It seems that only one DLL is far less than enough. It is also necessary to install a .NET Framework under Windows98.

In addition, find a clean Windows2000 environment test, the result is the same, still this error dialog.

3. Install Microsoft .NET Framework

In the 7CD VS.NET, the CD5 contains a directory, the directory name

DOTNETFRAMEWORK, there is only one file,

20.8MB of DotNetfx.exe, this is Microsoft .NET Framework. It can be installed when running it.

In a clean Windows2000 environment, run more DOTNETFX.EXE, install Microsoft .NET Framework. After the installation is prompted to restart. Now, that consoleapplication1.exe can finally run it normally!

Run the above DOTNETFX.EXE in Windows 98, install Microsoft .NET Framework, encounter a little problem, prompt .NET Framework needs IE5.01 or more. There is a directory IE60, 80MB in the CD5 of VS.NET. I have to install this IE6 first. Run IE6Setup.exe under the IE60 directory, install IE6. It is not necessary to say that IE60 needs to be restarted. Then install .NET Framework, restart. Run that consoleapplication1.exe, ah! Finally came out, "Hello World"!

4. Summary

In short, use C # compilation or feasible. The final EXE program can run in Windows98, Windows2000, XP. Just just install a 20MB Microsoft .NET Framework.

On the other hand, if the software to be developed is a large project, the end user is a senior user, then the development of C # is certainly no problem. If we want to develop software is a "Hello World", a little program, if the end user of the software is a primary user, that is not very suitable. One only 1MB software is not possible to drag a 20MB installation package. You can't find that the user is not installed .NET Framework is not running, which will lose too many users. Contact me: bookaa@mail.com

转载请注明原文地址:https://www.9cbs.com/read-1236.html

New Post(0)