您如何从记事本中编译代码? [英] How do you compile code from notepad?

查看:68
本文介绍了您如何从记事本中编译代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果困难,那么我可以使用一个可移植的编译器吗?

If it is difficult, then is there a portable compiler that I can use?

推荐答案

您可以使用csc.exe从命令行对其进行编译.

You compile it from the command line using csc.exe.


C#Express Edition是免费的. SharpDevelop也是如此.

The C# Express Edition is free. So is SharpDevelop.


这并不困难,更多的开发人员应该学习做到这一点.

安装.net时,还将安装C#和VB.net编译器(与Visual Studio使用的编译器相同).

> 0.打开一个DOS框;至少有两种方法可以执行此操作:
开始|运行cmd
开始|程序|附件|命令提示符

因为我广泛使用DOS盒,所以我将其放在快速启动工具栏上

1.确定您拥有的编译器版本:

It''s not difficult and more developers should learn to do it; it''s a very useful tool to have.

When you install .net, the C# and VB.net compilers are installed as well (these are the same compilers that Visual Studio uses).

0. Open a DOS box; there are at least two ways to do this:
Start|Run cmd
Start|Programs|Accesories|Command prompt

Because I use a DOS box extensively I have it on my Quick launch toolbar

1. Determine which versions of the compiler you have:

<br />C:\>dir /s /b "c:\windows\microsoft.net\framework\csc.exe<br />c:\windows\microsoft.net\framework\v1.1.4322\csc.exe<br />c:\windows\microsoft.net\framework\v2.0.50727\csc.exe<br />c:\windows\microsoft.net\framework\v3.5\csc.exe<br /> <br />C:\><br />



2.执行您选择的编译器,将您的源代码指定为参数:



2. Execute the compiler of your choice, specifying your source code as a parameter:

<br />C:\>c:\windows\microsoft.net\framework\v3.5\csc.exe Hello.cs<br />Microsoft (R) Visual C# 2008 Compiler version 3.5.30729.1<br />for Microsoft (R) .NET Framework version 3.5<br />Copyright (C) Microsoft Corporation. All rights reserved.<br /><br />C:\><br />



> 3.执行程序:



3. Execute the program:

<br />C:\>hello<br />Hello, world!<br /><br />C:\><br />



4.如果执行此操作,则f通常,您可能需要编写BAT文件来执行此操作:



4. If you do this frequently, you may want to write a BAT file to do this:

<br />C:\>type csc.bat<br />@c:\windows\microsoft.net\framework\v3.5\csc.exe %*<br /><br />C:\><br />



5.和/或将编译器的目录添加到Path环境变量
开始|设置|控制面板|系统|高级|环境变量|系统变量|路径|编辑



5. And/or add the compiler''s directory to the Path environment variable
Start|Settings|Control panel|System|Advanced|Environment variables|System variables|Path|Edit


这篇关于您如何从记事本中编译代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆