Writing and running ASP.NET vNext applications on a Mac

  • Tutorial
ASP.NET has risen from the ashes and takes confident steps to conquer the world! First, Microsoft has opened some of the .NET sources and continues to open them. The new version of ASP.NET vNext is open source right from the start and is hosted on GitHub . Secondly, from now on .NET will be cross-platform, just like the web server being developed. And this means that you can develop web applications on ASP.NET vNext in your cozy Macs and Ubuntochki.
Which I immediately decided to use.
IMHO. I think you do not need to explain about the beautiful C # syntax, strong typing, and high speed.
As for ASP.NET, everything was sad before, but over the past few years, MS has made great progress in developing the ASP.NET MVC web framework by taking best practices from RoR, Laravel, and others. And when a few months ago they officially announced that they were opening the source code for their framework and becoming cross-platform, the flame of love for them broke out again.


To start development on ASP.NET vNext under Mac you need to install the following software, frameworks and package managers:


Install Sublime Text 3


Sublime Text is a fast cross-platform source code editor for programs. Supports plugins in the Python programming language.

Sublime Text is not free or open source software, however, some of its plugins are distributed under a free license, and are also developed and supported by the developer community.

Go to the official website and download. An unregistered application can be used for an unlimited time (but a message will pop up periodically that ST3 is not registered).

Homebrew


The missing package manager for OS X. To install, open the terminal and copy the following command to install into the terminal:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew doctor


Add the following line to your .bash_profile or .zsh_profile
export PATH="/usr/local/bin:$PATH"


Install Node.js and Grunt


brew install node
npm install -g grunt-cli


Install Mono


brew install mono


Install Yeoman


Yeoman is perhaps the most popular scaffolder recently. In fact, Yeoman itself is not just a scaffolder, but a whole set of tools that complement each other perfectly in the scaffold process and are harmoniously combined in the development process. Yeoman "stands on three pillars" that set the tone for the workflow of modern developers: the Yo scaffolder, the Bower package manager and the Grunt task manager.

npm install -g yo
npm install -g generator-aspnet


To start scaffolding Yeoman, type in the terminal
yo aspnet

  • Select MVC Application
  • Create a project name



Yoman generated a blank of our future application (by the way, this is already quite a working site).



Install Utilities for ASP.NET vNext


brew tap aspnet/k
brew install kvm


Add a line to .bash_profile
source kvm.sh


Set up your new project in Sublime Text 3


Since this is your first ASP.NET project in ST3, you need to install Kulture (ASP.NET vNext extension for ST3):
  • Install the package control (if it is not already installed).
  • Call Command Palette (Cmd + Shift + P).
  • Type Package Control: Install Package .
  • In the list that appears, type Kulture .
  • Package Control will automatically install the latest version of Kulture.


To enable Intellisense for C #, install OmniSharp
- Using Package Control, install the OmniSharp package (follow the link for instructions on setting up OmniSharp ).

Run your project


  • Open in ST3 the folder with the project that Yeoman bullfinches.
  • Press Cmd + Shift + p
  • Enter K and select K Command
  • Before the first start, select kpm restore
  • Then kpm build
  • Now you can start the server and open your project in a browser. Start the server using the k kestrel command
  • Open your site in a browser at http: // localhost: 5004 /



Note: when writing this article I relied on material from the blog MARIA NAGGAGA (Microsoft Tech Evangelist).

Also popular now: