如何在命令行使用.NET Framework编译器来编译程序? [英] How to compile a program using .NET Framework compilers at command line.?
问题描述
我想使用.NET2.0编译器来编译c ++程序。
,所以我导航到c:\windows\Microsoft.Netframework\2.0.57\,并使用csc编译器进行编译。
它显示了很多错误。 / p>
但是它会编译csharp文件。但是在Visual Studio中会编译。
文件名test.cpp
使用命名空间系统;
类测试
{
void disp()
{
Console :: WriteLine( Hello);
}
};
void main()
{
test * t = new test();
t-> disp();
}
所以plz告诉我是否可以使用.net framework 2.0编译c ++文件
csc
是C#
使用 cl
(C ++),因此不要感到惊讶。编译器),并使用 / clr
开关来编译C ++ / CLI代码。另外,如果您有解决方案/项目文件,请使用 msbuild
。
请注意,C ++编译器不会.NET与C#编译器不同。
i want to compile a c++ program using .NET2.0 compiler. so i navigate to c:\windows\Microsoft.Netframework\2.0.57\ and uses csc compiler to compile.
It shows lot of errors.
But it compiles csharp file. But in visual studio it compiles. so i think that in visual studio c++ copiler installed i think so.
filename test.cpp
using namespace System;
class test
{
void disp()
{
Console::WriteLine("Hello");
}
};
void main()
{
test *t=new test();
t->disp();
}
so plz tell me is it possible to compile c++ file using .net framework 2.0 based comiler at command prompt and how?
csc
is the C# compiler, so you shouldn't be surprised that it doesn't compile C++.
Use cl
(the C++ compiler) with the /clr
switch to compile C++/CLI code. Alternatively, if you've got a solution/project file, use msbuild
.
Note that the C++ compiler doesn't ship with .NET, unlike the C# compiler.
这篇关于如何在命令行使用.NET Framework编译器来编译程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!