简体   繁体   English

在mono(mac)中编译C#visual studio控制台应用程序

[英]Compile a C# visual studio console application in mono (mac)

I am pretty new to mono and C# so this is probably a simple question, but i cannot find the answer. 我是单声道和C#的新手,所以这可能是一个简单的问题,但我找不到答案。 I need to compile a C# visual studio console application on my mac. 我需要在我的mac上编译一个C#visual studio控制台应用程序。 I thought mono would be right for that purpose. 我认为单声道是适合这个目的的。 I don't know which file to compile and took program.cs (where my main function is) or should i compile Project.csproj. 我不知道要编译哪个文件并使用program.cs(我的主函数所在的位置)或者我应该编译Project.csproj。 When i run 当我跑

gmcs Program.cs

I get 我明白了

Program.cs(17,16): error CS0246: The type or namespace name `Oplossing' could not be found. Are you missing an assembly reference?
Program.cs(129,54): error CS0246: The type or namespace name `Order' could not be found. Are    you missing an assembly reference?

What en how should i compile? 我该怎么编译?

Via xbuild, you should be able to compile csproj directly, 通过xbuild,你应该能够直接编译csproj,

http://www.mono-project.com/Microsoft.Build http://www.mono-project.com/Microsoft.Build

Unless you are working on a system without a ui, (since you are targetting macos you have a ui) download and install Monodevelop and open the visual studio project with that. 除非你正在使用没有ui的系统,(因为你的目标是maci,你有一个ui)下载并安装Monodevelop并用它打开visual studio项目。

Otherwise check the (g) mcs documentation The way to use it is already in te comments here 否则,请检查(g)mcs文档使用它的方法已在此处发表评论

Note: you do NOT have to recompile your app on MacOs to run it on MacOS, just copy the exe (assembly) to your mac and execute it with mono 注意:您不必在MacOS上重新编译您的应用程序以在MacOS上运行它,只需将exe(程序集)复制到您的mac并使用mono执行它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM