Best practices for .NET/MONO cross compiling

后端 未结 5 1047
自闭症患者
自闭症患者 2021-02-04 07:17

What are the best practices for writing code that can be cross compiled on .NET (windows) and Mono (linux)? Although I am very familiar with .NET, I am not that experienced in M

相关标签:
5条回答
  • 2021-02-04 07:52

    The Mono project provides a document with portability guidelines. That is a pretty good place to start.

    0 讨论(0)
  • 2021-02-04 07:56

    Check out The Mono Migration Analyzer

    0 讨论(0)
  • 2021-02-04 07:59

    You should be interrested by Prebuild :

    Prebuild is a cross-platform XML-driven pre-build tool which allows developers to easily generate project files for major IDE's and .NET development tools including: Visual Studio .NET 2002, 2003, 2005, SharpDevelop, MonoDevelop, NAnt and Autotools.

    0 讨论(0)
  • 2021-02-04 08:02

    We use MonoDevelop and Visual Studio for development but what's key is to keep around a good NAnt build script to build the entire thing on a single shot (Joel Spolsky's rules).

    The main point IMO is to state very clear that the software has to be cross-platform, so it is not about "porting to linux/mono" but actually developing each iteration on the required platforms.

    We had to avoid some features at the beginning (using Mono/.NET for 5 years now for a commercial product) and we still stick to .NET Remoting, but that's not a big deal in multi-platform development in my opinion.

    Counting on the soft debugger since almost one year is also a great thing.

    0 讨论(0)
  • 2021-02-04 08:09

    The biggest issues are sticking to the Mono-supported APIs. Using the Visual Studio Integration support in Mono can help a lot with this, since you can target Mono the entire time, on all platforms.

    For your specific questions:

    1) Interop - You'll need to stick to P/Invoke. Try to isolate this into separate, platform specific assemblies. This leads to 2:

    2) Using #if - I would avoid this, and prefer to use an extensibility model. Mono supports the Managed Extensibility Framework, which provides a good way to "plug in" platform specific code at runtime.

    0 讨论(0)
提交回复
热议问题