Develop ASP.NET vNext applications on a Mac

Develop ASP.NET vNext applications on a Mac

Rate This
  • Comments 13

Hi everyone, this post is in my name but it’s authored by Sourabh Shirhatti. He is a Program Manager Intern from the University of Texas at Austin that I’ve had the pleasure of working with this summer. Below is his story, I hope you enjoy it.

Prior to my internship with Microsoft, my web stack of choice was Node.JS + Express + MongoDB, and I primarily developed on a Mac. Like most of the Node.js community I had a minimalist environment; my tools of trade were Sublime Text, a terminal window and a browser. This kind of lightweight environment was not possible with ASP.NET.

Using Visual Studio at Microsoft showed me the benefits of a full-featured environment. The intelligent auto-completions coupled with an integrated build and test environment made Visual Studio invaluable. However, I still missed the lightning fast experience with Sublime Text.

With that in mind, I set out to build tools to make it easier to develop ASP.NET applications on my Mac. I have tried to identify the features I most missed from Visual Studio and how tooling could make my life easier.

To skip ahead to the download, just click http://github.com/ligershark/kulture/.

Create a new project

Starting out with a clean slate on my Mac. I ran into my first problem. How do I create a new project?

New Project Dialog in Visual Studio

Visual Studio makes it easy to generate the boilerplate for a new project. File -> New Project followed by two more mouse clicks and there you have a project that builds and runs.

Fortunately, the command-line community already has an excellent scaffolding experience through Yeoman. The logical next step was to build a yo generator for ASP.NET. The generator is hosted on GitHub at https://github.com/shirhatti/generator-aspnet where you can have a look and give it a spin. The code snippet below will get you started.

If you would like to follow along, click here for a more detailed instruction guide.

# Install yeoman
npm install -g yo
# Install the ASP.NET generator
npm install -g generator-aspnet
# Run the generator
yo aspnet

 02

Run my Project

Once I scaffolded out an empty project, I ran into another roadblock. How do I run my application?

In Visual Studio, it’s as easy as pressing F5.

I was able to one-up Visual Studio in Sublime Text 3 (ST3) by allowing you to run any of your custom k commands, and like any command in Sublime Text the key-binding is user-configurable. Here’s what my ST3 shows me when I press F5.

03

Thanks to the awesome folks on the Runtime team, you can now run your ASP.NET apps on a Mac using a cross-plat web server called Kestrel

This sounds exciting. How do I try it out?

You can try out the ST3 plugin at https://github.com/ligershark/Kulture

Show me my errors!

I have a boilerplate application that builds. I decide go ahead and add some code.Uh-oh! Looks like it doesn’t build anymore. How do I see the errors?

Visual Studio shows you a concise error list when your build fails with description, file name, line number and column number of each error.

04

Going for feature parity, that’s exactly what I tried to achieve in ST3.
Press F7 in Sublime and here’s what you see

05

Manage Dependencies

One of the key efforts with ASP.NET vNext was to trim the fat; every non-essential feature exists and lives in its own separate NuGet package allowing your app to include only what it needs.

This is great for reducing my footprint, but how do I discover packages and their version numbers to include in my project?

06

Providing completions for Package names and version numbers inside of project.json based on fuzzy matching made it easier to discover packages and add functionality to my application

Code Completions (In progress)

Error lists are awesome, but I wouldn’t have so many errors if ST3 helped me as I type. Can you suggest completions?

Visual Studio offers Intellisense, intelligent code completion and syntax checking that we all know and love. Fortunately, we don’t have to reinvent the wheel; the completions in Visual Studio are powered Roslyn, an Open Source C# compiler.

To achieve the same completions in ST3, we are working on providing out-of-process completions that are powered by Roslyn. I’ve been working with the Open Source community and I’m confident we’ll get this done after some initial promise.

https://twitter.com/sergey_litvinov/status/497391229068247041

https://twitter.com/sergey_litvinov/status/497391229068247041

image

https://twitter.com/jchannon/status/497017361556582400

You can follow the progress for Code Completions here.

Despite the aforementioned features, developing ASP.NET applications on a Mac is still not YET first-class experience. I say not yet because we are making strides in the right direction.

ASP.NET is Open Source.

All the code I’ve worked on this summer is also available on GitHub.

Join the party by opening issues or creating Pull Requests at https://github.com/ligershark/Kulture

Sourabh Shirhatti | @sshirhatti | http://shirhatti.com

Leave a Comment
  • Please add 7 and 6 and type the answer here:
  • Post
  • great tool, i hope one day we will have a visual studio version for each OS (linux, windows, MAC OS).

    that would be awesome.

  • Just wanted to express how cool this is and encourage you to continue pushing this forward.  Thank you for your valuable contributions!

  • @Julio Valencia

    Visual Studio for Linux would be totally amazing!

  • Awesome job! Gotta give this a go soon! Hopefully soon I can start doing all my .net dev from ST3 on linux at home.

  • What about Xamarian Studio?

    Did you tried to use vNext with it?

    Anyway this is great news.

  • If you would like to use a Nancy generator and create a Nancy application using ASP.Net vNext please take a look at my blog post. blog.jonathanchannon.com/.../nancy-aspnetvnext-osx-sublime-text

  • Wow really cutting edge. I like the streamlined approach.

  • Wow. Really streamlined approach. Keep up the good work.

  • Too much work just to develop an ASP.NET app on the Mac. Get real people. I get the latest fad is Apple now but in the business world it is all about productivity. If MS ever/when creates a Visual Studio for Mac call me. (I don't think they ever will because that will kill some of their OS market share. Why do you think they have not release an Office update for the Mac in 5 years? Think people.

  • Güzel bir çalışma

  • Awesome work! Waiting for resharper for Sublime ))

  • .net is a secure,for other programing language. its tool is so cool for develop any thinks.

  • Very interesting and looking forward how far this can go

    I'm curioius on why does Sourabh doesn't post in his blog, or if he does where's the link?

Page 1 of 1 (13 items)