【发布时间】:2012-05-16 07:49:43
【问题描述】:
我只有一个关于 C# 的问题。
我已经下载了 Microsoft Visual C# 2010 Express 来编写 C# 代码。
现在,我想使用相同的可视化 C# 编译代码。可以吗?
我已经搜索了一种编译代码的方法,但是我创建的所有方法都在谈论命令行“cmd”。 我尝试使用它,但它给了我“csc 不被识别为内部或外部命令.....”尽管我所在的目录与 C# 代码目录相同
我想编译并在输出中查看结果。
这是要编译的原始代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Project1
{
class Example1_1
{
public static void Main()
{
// display “Hello World!” on the screen
System.Console.WriteLine("Hello World!");
// display the current date and time
System.Console.WriteLine("The current date and time is " +
System.DateTime.Now);
}
}
}
按 F6 'build' 的结果是:
----- 构建开始:项目:Project1,配置:发布 x86 ------
Project1 -> C:\Users\Ali Alnufaili\AppData\Local\Temporary Projects\Project1\bin\Release\Project1.exe ========== 构建:1 个成功或最新,0 个失败,0 个跳过 ==========
如果您有任何建议,请告诉我。 ^_^
【问题讨论】:
-
你试过按 F7 或 Ctrl-B 吗?或者甚至只是去构建菜单。还是我错过了什么?
-
如果你想在另一个应用程序中编译代码it是你的答案
-
使用预配置的 shell:“
Visual Studio Command Prompt”。从那里您可以在解决方案文件上运行msbuild命令。如果您想自动执行此操作,只需将该 shell 中的所有环境变量值复制到您的脚本中即可。
标签: c# visual-studio-2010