DNX是.NET Execution Environment,前身是XRE,XRE的前身是KRuntime,项目网址:https://github.com/aspnet/DNX 。
签出DNX的代码:
git clone https://github.com/aspnet/DNX.git --recursive
安装Mono:
apt-get install mono-complete
运行./build.sh命令进行编译,出现错误:
WARNING: Invalid certificate received from server. Error code: 0xffffffff800b010a
WARNING: Invalid certificate received from server. Error code: 0xffffffff800b010a
WARNING: Invalid certificate received from server. Error code: 0xffffffff800b010a
WARNING: Invalid certificate received from server. Error code: 0xffffffff800b010a
Unable to find package 'KoreBuild'.
WARNING: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure
WARNING: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure
Unable to find version '0.2' of package 'Sake'.
通过下面的命令可以修复这个问题:
CERTMGR=/usr/local/bin/certmgr
sudo $CERTMGR -ssl -m https://go.microsoft.com
sudo $CERTMGR -ssl -m https://nugetgallery.blob.core.windows.net
sudo $CERTMGR -ssl -m https://nuget.org
sudo $CERTMGR -ssl -m https://www.myget.org/F/aspnetvnext/
mozroots --import --sync
继续编译,出现下面的错误:
./build.sh: 31: ./build.sh: source: not found
./build.sh: 35: ./build.sh: dnvm: not found
将build.sh文件中的第一行由 #!/bin/sh 改为 #!/usr/bin/env bash ,错误消失。
错误的原因是:在Ubuntu中,/bin/sh指向的是/bin/dash,而dash不支持source命令,详见source command not found in sh shell(http://stackoverflow.com/questions/13702425/source-command-not-found-in-sh-shell)。
继续编译,出现下面的错误:
info: Exec
info: program: kpm
info: commandline: restore
info: workingdir: src/Microsoft.Framework.ApplicationHost
warn: ApplicationName='kpm', CommandLine='restore', CurrentDirectory='src/Microsoft.Framework.ApplicationHost',
Native error= Cannot find the specified file
查看makefile.shade文件(这是Sake的配置文件),发现问题出在下面的配置部分
for each='var projectFile in Files.Include("src/*/project.json")'
exec program='cmd' commandline='/C kpm restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
exec program='kpm' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
for each='var projectFile in Files.Include("test/*/project.json")'
exec program='cmd' commandline='/C kpm restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
exec program='kpm' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
for each='var projectFile in Files.Include("samples/*/project.json")'
exec program='cmd' commandline='/C kpm restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
exec program='kpm' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
出错是因为找不到kpm命令。
.NET跨平台:在Linux Ubuntu上编译coreclr/corefx/dnx:http://www.linuxdiyf.com/linux/16991.html
.NET跨平台:在Ubuntu上用自己编译的dnx运行ASP.NET 5示例程序:http://www.linuxdiyf.com/linux/16990.html
.NET跨平台:在CentOS上编译dnx并运行ASP.NET 5示例程序:http://www.linuxdiyf.com/linux/16989.html
在CentOS上部署基于dnx/coreclr的ASP.NET 5应用程序:http://www.linuxdiyf.com/linux/16987.html
Ubuntu 15.04和CentOS 7部署.NETMono and DNX:http://www.linuxdiyf.com/linux/12013.html