Next, run dnvm to verify that your terminal understands this command. If it does not, run the command source dnvm.sh to link it, then try running dnvm again. You should see something like this:

使用Yemoman 创建Asp.net 项目
Mac 上 Asp.net 环境搭建好了以后,自己手动去开始一个 Asp.net 项目,是比较繁琐的。 Yeoman 上已经有 Asp.net 的 generator.
如果没有 Yeoman 先安装 Yeoman, Yeoman 的介绍: http://yeoman.io/ Yeoman下面有各种项目基础框架的generator
> npm install -g yo
安装 Asp.net generator
> npm install -g generator-aspnet
使用 yeoman 开启一个 Asp.Net 项目
> yo aspnet
这里使用 Nancy 框架, Nancy的介绍: http://nancyfx.org/ 一个轻量级的 .Net Web Framework
选择 Nancy ASP.Net Application

同时给一个项目名字,这里用了 NacyApp

项目基础文件框架就生产了。
进入 NacyApp 目录
执行
dnu restore
加载 依赖

如果 dnu 命令执行失败, commond not found.
执行命令:
source dnvm.sh
如果执行 dnu restore 出现 http://nuget.org/api/v2/ 取依赖包找不到的问题,切换一下源再试试,有两个可用的源:
1. https://www.myget.org/F/aspnetmaster/api/v2/
2. https://www.myget.org/F/aspnetvnext/api/v2/
例如:
dnu restore -s "https://www.myget.org/F/aspnetmaster/api/v2"
可以使用 core visual studio 打开工程,开始写程序。

然后 dnx . kestrel 开始你的 NacyApp 就可以了


这里有个有意思的事情,在terminal 里执行了 dnx . kestrel 后,如果想退出, 执行 ctrl+c 了以后,看到 terminal 没有反应,在浏览器里刷新一下页面, terminal 会出一个错误, 就退出了。

本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-07/120345.htm
