I am preparing for a talk I am about to give very soon (more to follow), and I wanted to demo some of the new features of ASP.NET MVC 6 on a Mac. It took reading instructions on multiple sites to get this to work, so I wanted to write it down in one place. Hopefully, this can help someone save a little bit of time. The only thing that is assumed to already be installed is npm.
- We start with installing brew, by running: (instructions here)
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Next, we need to install the command line tools for vNext. Details are available on this link:
brew tap aspnet/k brew install kvm
and in case your terminal won't understand kvm (and it probably won't on the first run), type
- Install the package manager in Sublime (this page has more details) by opening it's console (View - Console) and pasting in the following code:
import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
Install the Sublime add-on, Kulture, by pressing Cmd + Shift + P and selecting Package Control: Install Package , then finding Kulture
Scaffold a project by opening a terminal window, and typing:
npm install -g yo npm install -g generator-aspnet
then, create the actual project:
- Open the project
7. Grab the NuGet packages - we just scaffolded the project, now we need the NuGet files, so first, bring up the Command Palette again, by pressing Cmd + Shift + P, then select "K commands" and type kpm restore .
8. To build the project, I had to select the type of build manually. Automatic detection didn't work. Then, I pressed Cmd + B .
- Finally, open the Command palette again, by pressing Cmd + Shift + P , select Run K commands, and run K kestrel . Be wary of the port number, then, open your favourite browser and behold the beauty that is a MVC page on a Mac OS X.