Fixing VS2015 when it doesn’t want to run an ASP.NET vNext website

The quest I announced earlier to get a bare bones ASP.NET 5 (aka vNext) website running on a shared Linux hosting account begins.

A couple of weeks ago, I already downloaded and installed Visual Studio 2015 RC and started it to have a look around. Since then only used it to create a couple of code examples while answering questions on the web. So this will be the first attempt at creating and running a web site.

Let’s dive in.

Fire up Visual Studio 2015 RC and create a new ASP.NET Web Application project. Make sure to target the 4.6 .NET framework and to select the ASP.NET 5 web site template. The check boxes to add extra folders, to add unit tests and to host the site in Azure are all disabled. Sure hope they are going to be available in the RTM (Release To Market) version, especially adding a unit tests project! After some heavy grinding (and “Not responding” caption additions) Visual Studio shows the new project.

Good. Optimist that I am, I press the “Start” button. And … hit a snag:

Debugger cannot continue running the process

Dismissing that bothersome dialog, I notice that even both “Start” options in the Debug menu are grayed out:

Both start buttons grayed out

What the …?
This wasn’t in the script!

Following the “Run your app locally” link in the list of articles on the Project’s readme page, I read through Your First ASP.NET 5 Application Using Visual Studio. Nothing jumps out to me. Even though I didn’t read it beforehand (how could I, didn’t know it existed until the project was created), I basically followed it to the “T” and for all I know, the project should simply run. So, what is going on here?

Let’s do a sanity check. I haven’t really used Visual Studio to execute anything yet since switching to my brand new shiny laptop. So, do any of the other web projects still run? Let’s check with Visual Studio 2013. After all, I used that successfully to create those other projects and even deployed them to Azure, so they should be good to go.

Yay. ASP.NET MVC web application created with VS2013 runs in VS2013.

With a website project in VS2013 the “Start” button reads “Google Chrome” (my default browser in VS), not “Start” as it just did in VS2015. Wonder whether that means something?

VS2013 toolbar with start button showing "Google Chrome"

First, let’s see whether I can run this web site from VS2015. Loading it in VS2015, signs are looking good, the “Start” button in VS2015 now also reads “Google Chrome”. And yes, indeed, I can start and run the project without problems.

VS2015 Start button now also reading "Google Chrome"

Soooo, if VS2015 can run an ASP.NET 4.5 website without a hitch, but refuses to start an ASP.NET 5 website, it must have something to do with running ASP.NET 5 projects specifically.

Running ~ execution, so the .NET Execution Environment (DNX) link in the menu on the left of Your First ASP.NET 5 Application Using Visual Studio could certainly be relevant.

That DNX overview gives a lot of information. More than I want to know at the moment. The link to Working with DNX Projects seems promising, but leads to a “this has not been written yet” page. Bummer. Fortunately, there is a Getting Started” link. Aaaall the way at the bottom…, but it is there at least!

Installing ASP.NET 5 On Windows on that Getting Started page, sounds exactly like what I need. It just really irks me no end that this wasn’t part of the Visual Studio 2015 RC installation! Ah, uh, I guess it actually was. According to the installation instructions it is part of the VS2015 install, provided you specify that you want to install the “Microsoft Web Developer Tools”. Did I miss that? And if I did, why isn’t it checked by default?

Anyway, that is easy to fix, just modify the installation, right?

Uh, not so fast. Selecting Visual Studio 2015 in the “Programs and Features” part of the Control Panel and clicking “Change” brings up the installation dialog. With “Web Developer Tools” selected?! And the “Update” button is grayed out?

VS2015 "Modify" Installation dialog

Huh? It was installed? Then what is wrong with it?

According to the “manual installation” instructions (on the Installing ASP.NET 5 On Windows page), installing DNX requires installing the .NET Version Manager (DNVM) first. If it is installed, it should be possible to run “dnvm” from a command prompt (with administrator privileges) and get an intelligent response.

DNVM command output

Well … that part works.

To install DNX the instruction say to run “dnvm upgrade” and then “dnx” to check that it was configured correctly. Jumping the gun a bit I just ran “dnx”. And indeed, my poor Windows has no clue.

Windows has no clue about dnx command

Running “dnvm upgrade” goes without a hitch. And running “dnx” no longer produces blatant ignorance, but tells me what it is prepared to be told to do, i.e. lists the commands it knows about.

Curiously, neither the DNVM nor the DNX can be found anywhere in the “Programs and Features” part of the Control Panel. However, there is a “Microsoft DNX” folder in “Program Files”. Ah well, Windows runs in mysterious ways, I guess.

Back to where I was. Trying to run a newly minted ASP.NET 5 web site. Aka an ASP.NET vNext website. Firing up VS2015 RC and reloading the project, immediately makes it obvious something has changed. The “Start” button now reads “IIS Express”.

VS2015 Start button reading "IIS Express" for ASP.NET vNext website project

Let’s click it.

Yay! Success! It opens in my browser.

BareBones website showing in Google Chrome

But hang on, how do I know it is actually using DNX? The fact that it didn’t refuse to run is a clue, of course. As is the fact that the Task Manager shows there is a dnx.exe running. Cool. But… that could be from running “dnx” from the command prompt just now. The output log in Visual Studio brings certainty. It shows all manner of things being loaded from “C:\Users\marjan.dnx\packages\”, where DNVM just installed DNX.

Output log showing that it is loading dnx  packages

Victory!

Stay tuned for the next steps in the quest to get the BareBones site running on shared Linux hosting account.


If you don’t want to miss anything: subscribe below and get every post delivered straight into your inbox.

Posted in Learning
Tags: , , , , ,
5 comments on “Fixing VS2015 when it doesn’t want to run an ASP.NET vNext website
  1. Sampath says:

    The problem of your post is, very difficult to see the images.Why can’t you put those as its actual sizes ?

    • Marjan Venema says:

      Ah! Just wanted the wizard screenshots as small images as they are not too interesting. I forgot to reset the settings for the rest. Thanks for pointing it out.

  2. Matt Ferderer says:

    Just out of curiosity, what version of Powershell were you running? It sounds like you need at least version 3 when you initially create your project. I haven’t been able to sufficiently test this though. Without it I did receive an error that lead me to https://support.microsoft.com/en-us/kb/3025135. Half way down the page there is a symptom “DNX SDK version ‘dnx-clr-win-x86.1.0.0-beta5’ failed to install. The solution will use DNX SDK version ‘dnx-clr-win-x86-1.0.0-beta5’ for this session”

    • Marjan Venema says:

      No idea really. Have since upgraded to Win10, so can’t check any more, but when I did this it my machine was an all brand new and shiny Win 8.1 machine. If it wasn’t using the latest and brightest Powershell version available at the time, I’d be very surprised.

  3. Steve Bishop says:

    You just have to make sure the version in your global.json file matches the dnx version that is the default.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Show Buttons
Hide Buttons