Compiling Mono 3.8.0 on Windows

本文详细介绍了如何在Windows上使用Visual Studio编译Mono 3.8.0,并解决了与SQLite兼容性的问题。作者通过替换make工具、配置环境变量等步骤成功实现跨平台编译。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Compiling Mono 3.8.0 on Windows

I want to cross-platform develop c# on Windows with Visual Studio, for the Raspberry Pi running mono. I’m using SQLite for it’s embeddedness and portable database files. Now, while mono has support for SQLite, my version 3.2.3 happens to have a documented bug with Mono.Data.Sqlite. So it can’t work with .NET 4.0 on Windows.

Doom and despair: The mono project does not have a newer installer for Windows. The available one installs the 3.2.3 instead of current 3.8.0. Attempting to use the Mono.Data.Sqlclient.dll from the Raspberry Pi on the Windows machine was no help either and gave me a BadImageFormatException.

Thus, I compileth mono on my Win7 box…

I’ve been mostly following the official guidance [1] from the mono project here, with some extra steps and additional information from outside sources:

  • mono 3.2.3 was already installed
  • downloaded / installed cygwin
  • obtained mono 3.8.0 source tarball and extracted to disk
  • replaced cygwin make.exe with the make.exe from mono 3.8.0 [2]
  • Added the mono 3.2.3 bin folder to the PATH variable
  • In cygwin, did export MONO_PATH=”/cygdrive/c/Program Files (x86)/Mono-3.2.3″ [3]
  • Gave my account NTFS permissions to the <mono_3.8.0_src>\runtime folder
  • Did a ./configure --host=i686-pc-mingw32
  • Followed by make, make install

This took forever, yet worked like a charm.

Some caveats apply, because my Windows machine is 64bit:
I can’t build my application to AnyCPU target [4], and I have to use the 64bit version of the sqlite3.dll – least everything grinds to a halt with more BadImageFormatException.

But yes, I can now code and compile test.exe in VS on Windows, scp the test.exe to the raspberry, and run it there with mono test.exe. Not bad.

C# console application (test.exe) running on Raspberry Pi

Relevant Documents:

[1] http://www.mono-project.com/docs/compiling-mono/windows/
[2] http://shana.worldofcoding.com/en/mono_cygwin_tutorial.html
[3] http://www.mono-project.com/docs/compiling-mono/windows/compiling-with-visualstudio/
[4] http://stackoverflow.com/questions/15917204/badimageformatexception-c-sharp

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值