How to fix DNX/DNVM in Visual Studio 2015?
Solution 1
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:
Solution 2
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.
Solution 3
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.
Solution 4
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.!
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on July 09, 2022Comments
-
Admin almost 2 years
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?