While working with ASP.NET 5 application using Visual Studio 2015, you may encounter an error “dnx runtime package needs to be installed”. And you might be scratching your head after successful installation of Visual studio and .NET framework, what else it needs. And re-installing Visual studio won’t help either. Let’s dive in for the fix.
Fix for “dnx runtime package needs to be installed”
Visual studio comes with DNVM. DNVM stands for Dot Net Version Manager, and it’s a version manager command line tool. It is basically a set of command line instructions which allow you to configure your .NET Runtime. We can use DNVM to specify which version of the .NET Execution Environment to use at the process, user, or machine level. You can read more about DNVM here.
So to fix the error, You need to install required (or the latest) version of DNX using DNVM before building the solution. So in your Visual Studio -> Tools -> Nuget Package Manager -> Package Manager console. And run following command.
dnvm upgrade dnvm upgrade -r CoreClr
And after executing these 2 commands, if you don’t see any error then congratulation your problem is fixed. But it’s quite possible that you may encounter another error A positional parameter could not be found that accepts ‘CoreClr’ while executing these commands.
To fix this error along with above error, open command prompt and first verify
dnvm command works or not. You should see following screen after executing
Now you need to run both the commands here. First execute
dnvm upgrade and then
dnvm upgrade -r CoreClr. And you will see the DNVM is downloading the latest version of DNX.
Now, close your Visual studio and open again. And see if it’s build successfully or not. If you are still getting the same error then go to get.asp.net and download ASP.NET 5 RC. (At the time of writing this article, this is the latest version) and install it. This should fix the problem.
Please put your comments if this solves this issue for you and if you find any other way to fix this.