最近在 Ubuntu 下用 NAnt 時,有 50% 的機率會遇到類似這樣的錯誤:
The current runtime framework 'mono-2.0' is not correctly configured in the NAnt configuration file. Function call failed. Expression: ${path::combine(prefix, 'lib/mono/1.0')} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Illegal characters in path Parameter name: path1
找了好久,都不知道原因所在,因為有時候是正常執行的。去Google試了好幾個關鍵字,都找不到解。今天用 nant “Illegal characters in path” 去找,終於找到了:#483073 – nant: race condition on SMP systems – Debian Bug report logs
裡面提供的暫時解法是利用環境變數 MONO_NO_SMP,把 SMP 關掉,再執行即可。所以只要編輯 /usr/bin/nant,在 exec 之前加上 export MONO_NO_SMP=1 即可。