Let’s begin from the beginning: I installed  .Net Core SDK ,  Visual Studio Code (VSC) and the C# extension. The tricky part was the SDK which uses OpenSSL . I had  to install it  beforehand with Homebrew.

At this point a basic development environment is place. But since I didn’t want to develop a CLI application but an Asp .Net MVC one, and since VSC does not provide project scaffolding like it’s big brother, Visual Studio, I had to install yeoman for this task (another cli tool) a task that, requires Node.js so that you end up with npm and finally run

npm install -g yo generator-aspnet bower

(Yes, it has to have bower too).

And now, everything is ready to start a project. I run:

yo aspnet

and got

     _-----_     ╭──────────────────────────╮
    |       |    │      Welcome to the      │
    |--(o)--|    │  marvellous ASP.NET Core │
   `---------´   │        generator!        │
    ( _´U`_ )    ╰──────────────────────────╯
    /___A___\   /
     |  ~  |     
   __'.___.'__   
 ´   `  |° ´ Y ` 

? What type of application do you want to create? (Use arrow keys)
❯ Empty Web Application 
  Empty Web Application (F#) 
  Console Application 
  Console Application (F#) 
  Web Application 
  Web Application Basic [without Membership and Authorization] 
  Web Application Basic [without Membership and Authorization] (F#)

I chose

 Web Application Basic [without Membership and Authorization]

and was good to go.

Or, was I?

Client side development encompasses tasks like building css from sass or less, bundling and minifying. I had to accommodate for these too. I decided for scss so I had to install sass.

gem install sass

(Has anyone been counting the package managers used so far? I will provide a count later).

And, per the .Net Core tutorials and documentation, I had to install gulp for sass compilation (and bundling/minification). Thank God, npm was already in place.

npm install --save-dev gulp

At this point I could open my newly created project (ok, the screenshot was taken later).

screen-shot-2016-11-16-at-8-06-30-pm

Database connectivity would have to wait a bit, until we get the basics straight.

The last piece I had to install was the C# extension. Yes, C# is not supported by default! You need to add it as an extension from within VSC.

VSC is mainly addressed to javascript developers, it seems.

So, to come here I have used the following package managers:

  • brew
  • npm
  • gem
  • bower
  • nuget (internally in VSC)

and two additional cli tools

  • yeoman
  • gulp

Unfortunately, after having done all the above, I found out that gulp will be discontinued in future releases (Bye, bye gulp).

And advancing a little bit with the configuration, I found also that the current project.json is going to be replaced by MSBuild (Bye, bye project.json).
Honestly, this gave me the creeps, not because I have any particular affection for either gulp or project.json but because it shows a fickleness of ‘heart’ towards the adopted affiliations. If one wants to adopt something new, the last thing he needs in uncertainty.

Having said that, it doesn’t seem to be a compromise on Microsoft’s newly developed commitment to openness, as, today, they announced joining the Linux foundation and they released Visual Studio for Mac (preview).

 

It’s been now quite a few days that I have been working with the current environment and apart from some annoyances that I will list below, I am rather happy, mostly because VSC is not just an editor. It has a lot of IDE capabilities, something that I have been missing to other lighter editors, or found too cumbersome to work with.

And since Intellisense is one of my main reasons for satisfaction, it is its shortfalls that frustrate me the most:

  • Version management in project.json is messy. Intellisense suggestions sometime are wrong (I got hints for version 2.0.0 and 3.0.0 where the package is still in 1.x.x), other times they do not show up at all.
  • Enabling Visual Studio Code Taghelpers did not help. Taghelpers Intellisense does not work. I posted a relevant question in Stackoverflow which, to the moment of writing, remains unanswered.
  • After correcting some misprints or wrong references in the code, there are artifacts left behind (red squiggly lines, underlining the problem that does not exist anymore). They go away with the first compilation though.

But with the current environment I have done a lot of progress in two areas: after creating the basic views and controllers, I spent a lot of time in route configuration and localization, which, I remind to those that haven’t read my previous post, is to migrate the company website from WordPress to Asp Net MVC.

Advertisements

One thought on “.Net Core on a Mac: Setting the development environment

Comments are now closed.