使用 MonoDevelop 在 linux 上编译 windows
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6812304/
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
Compile for windows on linux using MonoDevelop
提问by Keelx
I want to know, because I can't find anything on google, If I use MonoDevelop to compile an application on Linux, can I send the generated executable to a Windows computer and expect it to run? file
outputs this:
我想知道,因为我在google上找不到任何东西,如果我在Linux上使用MonoDevelop编译应用程序,我可以将生成的可执行文件发送到Windows计算机并期望它运行吗?file
输出这个:
PE32 executable for MS Windows (console) Intel 80386 32-bit Mono/.Net assembly
so I would expect it to run on Windows out-of-the box. But I sent it to a friend for testing, and it said 'this is not a valid win32 application'. So, what do I need to do? It is just a basic hello world console application in C#.
所以我希望它可以在 Windows 上开箱即用。但是我将它发送给朋友进行测试,它说“这不是有效的 win32 应用程序”。那么,我需要做什么?它只是一个基本的 C# hello world 控制台应用程序。
回答by Teoman Soygul
You have to have the exact version of Mono installed on the target machine or a matching version of .NET Framework (i.e. if you compiled against Mono 2.10.x, you'll most probably need .NET 4.0). Otherwise you'll get that exact error message.
您必须在目标计算机上安装准确版本的 Mono 或匹配版本的 .NET Framework(即,如果您针对 Mono 2.10.x 进行编译,则很可能需要 .NET 4.0)。否则你会得到那个确切的错误信息。