简体   繁体   中英

Compiling a mono application from windows for macOS/CentOS

Can I compile a C# mono project from Windows for Mac and for CentOS directly? I saw a Video. The author installed Mono on Mac/Linux and used the parameter 'Mono Project' to run it on the platform. Does the application become compiled on Mac/Linux or does the app run in the Mono environment?

Assuming that your code is only "managed code" (ie C# or similar compiling to IL), you should be fine to build on one operating system and run on another, so long as that operating system supports all the libraries you're using. That's the case even if you're using libraries that themselves contain native code, assuming it's been bundled correctly.

It becomes trickier if your own code includes native code (eg C++) - at that point you'd need to cross-compile for each operating system and architecture you're targeting. That's less likely to be the case though. If you're doing it, you're likely to know you're doing it :)

Note that you'll need to work out what you need to ship with your application in terms of libraries etc, and what the requirements are in terms of Mono or .NET Core already being installed.

Unless you need Mono-specific libraries, I'd personally suggest using .NET Core at this stage rather than Mono. Mono's currently the best solution for mobile deployment (Xamarin, Unity) but if you only need to run on desktops, and you're not using any Mono libraries, I find .NET Core to be a more polished experience.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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