How to setup an ASP.NET MVC 5 with Entity Framework and Membership using Visual Studio Code?

This is my first post for this year, it is a pretty delayed update (ごめんなさい), been busy (忙しい), but I can’t wait to share to you guys one of the coolest feature of the new ASP.NET.  The ability to run ASP.NET on any operating system using Visual Studio Code, how cool is that!  Microsoft totally overhauled the entire product and a paradigm shift is absolutely necessary for old developers like me.  Wow!  so lets get started, shall we!

First download Visual Studio Code (the new IDE) using this link:

Since the new IDE is only an editor, you will need to install a package manager.  The package manager that you should install is npm.  npm is a package manager associated with nodejs, so just download nodejs using this link ( and install.  Boom!

The next to be installed is the ASP.NET execution environment, the new execution environment is ASP.NET 5/DNX.  The new execution environment can run on any operating system, e.g., Windows, MAC, Linux, etc.  I am using a Windows machine so I’ll be using a command line and sample image below:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "&{$Branch='dev';iex ((new-object net.webclient).DownloadString(''))}"


After the installation make sure you type in the following command:

dnvm upgrade

So now we have our IDE Editor (Visual Studio Code),  Package Manager (npm) and Execution Environment (dnvm).  We are ready to build our first application!

To create your first application just type in the following commands:

npm install -g yo grunt-cli generator-aspnet bower
yo aspnet
dnu restore

The first command,”npm..”, installs all packages necessary to build your first application.  The second command “yo…” creates your application directory and ASP.NET base code scaffolding.  By the way, choose “Web Application” from the list provided by the second command so that Entity Framework and Membership are included in the scaffolding.

Go inside to your application directory by typing “cd” command, once inside the directory type “dnu…”.   This step enables you to download all the necessary bin packages for your project, e.g., Entity Framework, ASP.NET Core, etc.  via NUGET!  The reason why you need this command is that the scaffolding you just downloaded does not contain any references, this will download those references for you.

The last command is “code”, this will execute and run Visual Studio Code.  And now you will see this:


To test if you can run your application, just press Ctrl+Shift+P, then type dnx: Run Command: See image below: (DO THIS TWICE, to remove the Omnisharp error)


Actually when your doing the dnx: Run Command you are already compiling and executing your application.  And take note of URL http://localhost:<PORT> as shown in the image below.  Open a browser and type that URL.


Now you have a running ASP.NET 5 Application with Entity Framework and Membership!


That’s it!  The next blog will be configuring your data, till then! and if you find this blog helpful, you can make the donation by clicking the Paypal button below.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s