ASP.NET 5 is something special. We can build cross platform Web apps using .NET Core that run on OSX, Linux and Windows. But how do you get started on OSX? This post shows how quickly you can get up and running.
Dan Wahlin, Ward Bell and I are hosting an ASP.NET 5 workshop at DevIntersections / Anglebrackets in Las Vegas in Novemxber. Use promo code PAPA to get $50 off the event and come visit us. Registration will open in early June.
Here are some commands you should get familiar with:
- dnvm is the .NET version manager. You'll run this occasionally to update your versions
dnu is the .NET package updater. This can update nuget packages and can also help update npm and bower packages via
dnx is the .NET execution runtime. You'll use this to run your app
First, start with getting the tools you need so you can run ASP.NET. The first step is to install homebrew, which is like Walmart for OSX. Homebrew makes it easy to download and install ton of great software libraries and tools. We'll use this to install and setup ASP.NET.
- Install homebrew by entering this at a terminal
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Use homebrew to get ASP.NET
brew tap aspnet/dnx brew update
- Add the following to the
~/.bashrcfile. This makes it easy to use dnvm.
- Use homebrew to get the .NET version manager (dnvm) and upgrade the dnvm to the latest version
brew install dnvm dnvm upgrade
File New ProjectCreating a new project is easy with Yeoman. This is my preferred way to scaffold new projects on Mac or Windows. No more file new for me in the IDE! There is a generator that the ASP.NET team helps curate named generator-aspnet. This is a good starting place, though I and many others will also be creating generators too.
- Install yo and gulp. You will use yo to run the generator and gulp to help automate tasks.
npm install -g yo gulp npm install -g generator-aspnet
- Install the ASP.NET generator and run it with the gulp option. This generators a project using gulp, instead of grunt.
yo aspnet --gulp
- Choose your project type. Web API Application, Empty Web, Console, or MVC Web App.
run the app
When you modify the packages list in
dnx . kestrel
project.jsonyou should run
dnu restoreto get the latest ones. Enjoy!