Install Asp. Net in Mac OS and use Yeoman to create an Asp. Net project, yeomanasp.net

Source: Internet
Author: User
Tags install homebrew

Install Asp. Net in Mac OS and use Yeoman to create an Asp. Net project, yeomanasp.net

This article is a summary of the problems encountered during installation of Installing ASP. NET 5 On Mac OS.

The original text prompts are as follows:

Installing ASP. NET 5 On Mac OS X
By Steve Smith

ASP. NET 5 runs on. NET Execution Environment (DNX), which is available on multiple platforms, including OS X. this article describes how to install DNX, and therefore ASP. NET 5, on OS X, using Homebrew.

In this article:
Install ASP. NET 5 on OS X
Install ASP. NET 5 on OS X
ASP. NET 5 requires DNX, which is installed and managed by. NET Version Manager (DNVM ). the DNVM is easily installed using a tool called Homebrew, which will also install the correct version of Mono for OS X.

Install Homebrew
The first step is to install Homebrew if it's not already installed. This can be done from a Terminal prompt using this script:

Ruby-e "$ (curl-fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )"



The installer will inform you of the steps it is taking and pause before proceeding. You can learn more about Homebrew here.

In this step, brew may have been installed.


Run the following command:

Brew-v




Install the. NET Version Manager (DNVM)
Once Homebrew is installed, install the DNVM by running brew tap aspnet/dnx from a Terminal window. if you need to update your version of DNVM, first run brew untap aspnet/dnx to delete the old commands, and then run the brew tap aspnet/dnx command again to get the updated scripts.


If you had an older version of our Homebrew "tap" configured, you might get the following error: cocould not create link for aspnet/dnx/kvm, as it conflicts with aspnet/k/kvm. in that case, simply run brew uninstall kvm to ensure any old versions of kvm are removed, then brew untap aspnet/k to remove the old tap. after that, the brew tap aspnet/dnx command shoshould succeed.

Next, run the command brew install dnvm to install the. NET Version Manager. This will also automatically install the latest DNX package from the https://www.nuget.org/api/v2 feed.

In this step, you may have no permissions:


Run

Chown root: wheel/usr/local/bin/brew


Then execute

Brew link mono



Complete the installation. Everything is normal.

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 shoshould see something like this:

 

Use Yemoman to create an Asp.net Project

After the Asp.net environment is set up on Mac, it is cumbersome to manually start an Asp.net project. There is Asp.net generator on Yeoman.

If no Yeoman first installs Yeoman, Yeoman Introduction: http://yeoman.io/Yeoman has various project infrastructure framework generator

> Npm install-g yo



Install Asp.net generator

> Npm install-g generator-aspnet



Use yeoman to start an Asp. Net Project

> Yo aspnet


Using the Nacy Framework, Nacy Introduction: http://nancyfx.org/a lightweight. Net Web Framework

Select Nacy ASP. Net Application


At the same time, give a project name. NacyApp is used here.


The basic project file framework will be produced.

Go to the NacyApp directory

Run

Dnu restore



Load dependency


If the dnu command fails to be executed, commond not found.

Run the following command:

Source dnvm. sh



If the execution of dnu restore has a problem that the http://nuget.org/api/v2/ cannot find the dependency package, switch to the source and try again, there are two available sources:

1. https://www.myget.org/F/aspnetmaster/api/v2/
2. https://www.myget.org/F/aspnetvnext/api/v2/

For example:

Dnu restore-s "https://www.myget.org/F/aspnetmaster/api/v2"



You can use core visual studio to open the project and start writing programs.


Then dnx. kestrel starts your NacyApp.




Here is an interesting thing. dnx is executed in terminal. if you want to exit kestrel, after you execute ctrl + c, you will see that terminal does not respond. Refresh the page in the browser, and terminal will get an error and quit.

 

Original blog address: http://zhangsichu.com/blogview.asp? Content_Id = 151 http://zhangsichu.com/blogview.asp? Content_Id = 153

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.