标签:
自从XRE改名为DNX至今,从来没有在Mac OS X上成功编译过DNX。一直很纳闷,难道DNX的开发人员不用Mac?今天突然明白了,DNX的开发人员真的不用Mac。而且DNX用的2个持续集成服务AppVeyor与Travis,一个是Windows环境,一个是Linux环境,就是没有Mac OS X环境。
看来不能指望DNX的开发人员短期内解决这个问题了,只能自己动手。
编译的错误信息如下(编译命令./build.sh):
Restore complete, 725ms elapsed info: Target initialize info: Target build-managed-projects info: Exec info: program: kpm info: commandline: pack src/dnx.host --configuration Debug info: workingdir: /git/dotnet/dnx warn: ApplicationName=‘kpm‘, CommandLine=‘pack src/dnx.host --configuration Debug‘, CurrentDirectory=‘/git/dotnet/dnx‘, Native error= Cannot find the specified file verbose: Stack trace: at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in :0
从错误信息看,是找不到kpm引起的,kpm不是改名为dnu了吗?怎么还在找kpm?
打开build.sh文件一看,编译实际使用的命令是:
mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@"
Sake是一个在ASP.NET vNext时期临时开发出来的.NET跨平台构建工具(目测会被跨平台的msbuild取代),目前DNX的编译还是借助于Sake。
打开packages/KoreBuild/build文件夹,发现其中有三个与kpm相关的文件:
_kpm-build.shade,_kpm-pack.shade,_kpm-publish.shade
打开一看,文件中的确调用了kpm命令:
exec program=‘cmd‘ commandline=‘/C kpm pack${pack_options} ${projectFolder} --configuration ${configuration}‘ if=‘!IsMono‘ exec program=‘kpm‘ commandline=‘pack${pack_options} ${projectFolder} --configuration ${configuration}‘ if=‘IsMono‘
于是,将kpm改为dnu:
exec program=‘cmd‘ commandline=‘/C dnu build${build_options} ${projectFolder} --configuration ${configuration}‘ if=‘!IsMono‘ exec program=‘dnu‘ commandline=‘build${build_options} ${projectFolder} --configuration ${configuration}‘ if=‘IsMono‘
改过之后,重新build,之前的错误消失了,原来是改名惹的祸!
但是出现了新的错误:
System.Net.WebException: Error: SendFailure (The object was used after being disposed.) ---> System.ObjectDisposedException: The object was used after being disposed. at System.Net.WebConnection.BeginWrite (System.Net.HttpWebRequest request, System.Byte[] buffer, Int32 offset,
Int32 size, System.AsyncCallback cb, System.Object state) [0x00000] in <filename unknown>:0
后来在DNX的Issue(Fail to build using dnu build)中得知,这是Mono 4.0.1的bug引起的。
于是,只能等Mono修复这个bug,才能继续尝试在Mac上编译DNX。
标签:
原文地址:http://www.cnblogs.com/dudu/p/try_build_dnx_on_mac.html