C# 如何使用 Mono 的 mcs 编译和运行 csproj 文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13664441/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 09:22:04  来源:igfitidea点击:

How can you use Mono's mcs to compile and run a csproj file?

c#monogmcs

提问by Kevin Burke

I'm a Unix guy who needs to try and compile some C# code for work. I've downloaded Mono for Mac, and the mcs command line tool. There's a csproj file attached to this library which contains XML with all of the files I need to compile.

我是一个需要尝试编译一些 C# 代码才能工作的 Unix 人。我已经下载了 Mac 版 Mono 和 mcs 命令行工具。这个库附带了一个 csproj 文件,其中包含我需要编译的所有文件的 XML。

Can Mono/mcs read this csproj file and generate a DLL from it?

Mono/mcs 可以读取这个 csproj 文件并从中生成一个 DLL 吗?

回答by vidstige

The easiest way is to head over to monodevelopand download their IDE. It can open project files generated by Visual Studio.

最简单的方法是前往monodevelop并下载他们的 IDE。它可以打开 Visual Studio 生成的项目文件。

Now you can also use the convenience of aptitude as below:

现在您还可以使用 aptitude 的便利,如下所示:

sudo apt-get install monodevelop mono-gmcs

回答by Greg Najda

If you don't want to use MonoDevelop and want to use the command-line, you can use xbuild. xbuild is the Mono equivalent of MSBuild.

如果不想使用 MonoDevelop 而想使用命令行,则可以使用 xbuild。xbuild 是 MSBuild 的 Mono 等价物。

xbuild /p:Configuration=Release HelloWorld.csproj

回答by mivk

For Ubuntu, and probably other Debian-based distributions:

对于 Ubuntu,可能还有其他基于 Debian 的发行版:

sudo apt-get install monodevelop mono-gmcs

(mono-gmcsmay be needed to compile .net 2.0 or 3.5 projects)

mono-gmcs可能需要编译 .net 2.0 或 3.5 项目)