58

Today I installed VS 2015 on Windows 7 x64. Mainly to test new .Net Core features and etc. And for test I created new C# "Console Application (Package)" solution and got this message:

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.

I can't compile and debug project. Also, when I have opened debug tab in project properties then VS crashed.

DNVM output when I opened solution:

Invoke-Command : The term 'x86' is not recognized as the name of a cmdlet, func
tion, script file, or operable program. Check the spelling of the name, or if a
 path was included, verify that the path is correct and try again.
C:\Program Files\Microsoft DNX\Dnvm\dnvm.ps1:1451 ????:27
+             Invoke-Command <<<<  ([ScriptBlock]::Create("dnvm-$cmd $cmdargs")
)
    + CategoryInfo          : ObjectNotFound: (x86:String) [Invoke-Command], C 
   ommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Co 
   mmands.InvokeCommandCommand

Invoke-Command : The term 'x86' is not recognized as the name of a cmdlet, func
tion, script file, or operable program. Check the spelling of the name, or if a
 path was included, verify that the path is correct and try again.
C:\Program Files\Microsoft DNX\Dnvm\dnvm.ps1:1451 ????:27
+             Invoke-Command <<<<  ([ScriptBlock]::Create("dnvm-$cmd $cmdargs")
)
    + CategoryInfo          : ObjectNotFound: (x86:String) [Invoke-Command], C 
   ommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Co 
   mmands.InvokeCommandCommand

Invoke-Command : The term 'x86' is not recognized as the name of a cmdlet, func
tion, script file, or operable program. Check the spelling of the name, or if a
 path was included, verify that the path is correct and try again.
C:\Program Files\Microsoft DNX\Dnvm\dnvm.ps1:1451 ????:27
+             Invoke-Command <<<<  ([ScriptBlock]::Create("dnvm-$cmd $cmdargs")
)
    + CategoryInfo          : ObjectNotFound: (x86:String) [Invoke-Command], C 
   ommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Co 
   mmands.InvokeCommandCommand

Any ideas how to fix it?

Also, I have previously installed VS 2015 Preview and DNX/DNVM separately. But I think, I completely removed it before VS 2015 installation. Could this somehow affects current VS installation?

8 Answers8

55

This is a known issue.

ASP.NET 5: On Windows 7 SP1, DNX SDK cannot be installed without Powershell 3.0.

Symptoms

When you create an ASP.NET 5 project, you receive the following error message:

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

Workaround

To work around this issue, install Windows Powershell 3.0 (or higher) and try to create the project again. To see your current PS version, run $PsVersionTable command (details).

Links:

Community
  • 1
  • 1
Vincent
  • 22,366
  • 18
  • 58
  • 61
  • 2
    Installing Powershell 3.0 did the job for me! Thanks! – Joseph Woodward Jul 23 '15 at 13:18
  • 1
    I installed Powershell 4 (Windows 7 OS) and it worked as well. Figured I'd skip 3. :) – Geoff Gunter Jul 25 '15 at 00:32
  • I am getting this error message. I've had PowerShell installed for some time, but I just installed VS2015 this past Tuesday to start learning MVC. Does that mean I have to scrap all of the work I've done on MVC for the last couple of days and just create my project again? What's to say this won't happen again and again? –  Aug 20 '15 at 13:15
  • Maybe it was the version of PowerShell I installed, but as well as this step I had to follow the one from ph1ll (i.e. edit the dnvm.ps1 file) below to get everything working. – monty Sep 09 '15 at 22:51
  • In addition to this answer and ph1ll's answer below, I had to make sure VS was running in Admin mode when I tried to build my project. Then it worked! – kyoob Jul 28 '16 at 11:09
  • I already have PowerShell 4.0 and still got this error. But `dnvm upgrade` solution by @AlejandroC helped out!. – Mobigital May 12 '17 at 18:09
14

Install the latest version by opening a console and running:

dnvm upgrade

If you reopen VS you should be able to compile.

If this doesn't work, try deleting the C:\Users\username\.dnx folder. Reopen VS and it will recreate the .dnx folder in the same location with only 2 scripts: bin\dnvm.cmd and bin\dnvm.ps1 Note: This would delete all already installed runtimes.

Rerun dnvm upgrade and check under the project properties if the Solution DNX SDK Version you have matches an installed one.

carraua
  • 1,398
  • 17
  • 36
10

I am also having this problem. It appears to be related to an issue where the dnvm.ps1 script does not quote the install path. The command dnvm install "C:\Program Files (x86)\Microsoft Web Tools\DNX\dnx-clr-win-x86.1.0.0-beta5.nupkg" from Visual Studio gets recalled as dnvm-install C:\Program Files (x86)\Microsoft Web Tools\DNX\dnx-clr-win-x86.1.0.0-beta5.nupkg, which breaks as the path should be quoted. More information is available on the pull request I opened at:

https://github.com/aspnet/dnvm/pull/357

As a workaround, the solution for me was to change the following in "C:\Program Files\Microsoft DNX\Dnvm\dnvm.ps1". This loops through the arguments, ensuring that any containing whitespace or parenthesis are quoted.

Replace the following line:

$cmdargs = @($args[1..($args.Length-1)])

with:

# Combine arguments, ensuring any containing whitespace or parenthesis are correctly quoted 
ForEach ($arg In $args[1..($args.Length-1)]) {
    if ($arg -match "[\s\(\)]") {
        $cmdargs += """$arg"""
    } else {
        $cmdargs += $arg
    }
    $cmdargs += " "
}

If you are still having issues following making this change, delete C:\Users\username\.dnx and reopen Visual Studio to let Visual Studio recreate the folder.

Bjørn-Roger Kringsjå
  • 9,849
  • 6
  • 36
  • 64
ph1ll
  • 421
  • 3
  • 8
  • This should be the accepted answer! Just do `dnvm install "C:\Program Files (x86)\Microsoft Web Tools\DNX\dnx-clr-win-x86.1.0.0-beta5.nupkg"` in the `Package Manager Console` – Serj Sagan Aug 25 '15 at 01:42
  • @SerjSagan Your suggested command doesn't work. It gives the same error. (It's actually the same command as the original script tries to execute, and failing.) – MEMark Sep 05 '15 at 09:08
  • thanks @ph1ll.. now I'm just curious why it thought beta5 was what should be installed when I restarted VS – Shane Courtrille Sep 17 '15 at 03:43
7

I could fix it by this way: In Developer Command prompt for 2015 enter this command

dnvm install 1.0.0-beta5

sure this way will can fix your issue.!

0

My version of powershell was 3.0, then I:

  1. Install powershell v.4 from:

https://www.microsoft.com/en-us/download/details.aspx?id=40855

  1. Reboot windows

This solve my problem.

Lev K.
  • 344
  • 4
  • 4
0

I had a similar problem earlier today, and the way in which I managed to solve it after reading the comments in this page was very straight forward.

First of all I have to say that I already had PowerShell 3.0 installed (not having it installed seems to be the main source of this problem for most people) and yet I still was having this same issue.

So instead of having to edit and modifying the powershell scripts involved in order to make them work with paths with whitespaces, etc as suggested, I just simply did as follows (much simpler):

1.- Go to "C:\Program Files (x86)\Microsoft Web Tools\DNX" in Windows explorer and "copy" all its content (basically all the packages and their sub-folders)

2.- "Paste" all that content into a path with no blank spaces. I used "C:\Temp\"

3.- Run the following commands on the command line (notice there are no blank spaces now in the path locations indicated)

dnvm update-self
dnvm install "C:\Temp\dnx-clr-win-x64.1.0.0-beta5.nupkg"
dnvm install "C:\Temp\dnx-coreclr-win-x64.1.0.0-beta5.nupkg"
dnvm list

4.- Open your Visual Studio solution now and on your Project -> Properties -> Application tab, in there you can now specify the version of the DNX SDK that you want to use from those of which you have now available

5.- Re-build your solution and it should now be all fine

Nice one!

Jesus Campon
  • 422
  • 4
  • 4
0

try

dnvm update-self
dnvm install -u  -r clr  -OS win  -a x86  beta5 -ngen 

important are the -u parameter (unstable) and the beta5 version string.

MovGP0
  • 7,267
  • 3
  • 49
  • 42
0

If anyone have problems with dnx not available in Visual Studio 2015 while watching some bit outdated tutorials ( like me ) check below link

The RC2 release of .NET Core and ASP.NET Core 1.0 moved from DNX to the .NET Core CLI.

In the table on the linked page you will the mapping between the DNX/DNU commands and their CLI counterparts. for example:

dnx run becomes dotnet run

scx
  • 2,749
  • 2
  • 25
  • 39