首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在Visual Studio 2015中修复DNX/DNVM?

如何在Visual Studio 2015中修复DNX/DNVM?
EN

Stack Overflow用户
提问于 2015-07-22 01:55:01
回答 8查看 40.9K关注 0票数 58

今天我在Windows7 x64上安装了VS2015。主要是测试新的.Net核心特性等。为了测试,我创建了新的C#“控制台应用程序(包)”解决方案,并得到了以下消息:

DNX SDK版本'dnx-clr-win-x86.1.0.0-beta5‘安装失败。该解决方案将在此会话中使用DNX SDK版本‘dnx-clr-win-x86.1.0.0-Beta5’。

我不能编译和调试项目。此外,当我在项目属性中打开debug选项卡时,VS崩溃了。

当我打开解决方案时,DNVM输出:

代码语言:javascript
复制
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

有什么办法解决这个问题吗?

另外,我之前已经分别安装了VS2015预览版和DNX/DNVM。但我认为,在VS 2015安装之前我已经完全删除了它。这会以某种方式影响当前的VS安装吗?

EN

回答 8

Stack Overflow用户

回答已采纳

发布于 2015-07-22 04:44:58

这是一个known issue

ASP.NET 5:在Windows7 SP1上,如果没有Powershell 3.0,则无法安装DNX SDK。

症状

创建ASP.NET 5项目时,会收到以下错误消息:

DNX SDK版本'dnx-clr-win-x86.1.0.0-beta5‘安装失败。该解决方案将在此会话中使用DNX SDK版本‘dnx-clr-win-x86-1.0.0-Beta5

解决方法

要解决此问题,请安装Windows Powershell 3.0 (或更高版本),然后尝试重新创建项目。要查看您当前的PS版本,请运行$PsVersionTable命令(details)。

链接:

票数 55
EN

Stack Overflow用户

发布于 2015-08-13 23:18:34

通过打开控制台并运行以下命令Install the latest version

dnvm upgrade

如果你重新打开VS,你应该能够编译。

如果此操作不起作用,请尝试删除C:\Users\username\.dnx文件夹。重新打开VS,它将在相同的位置重新创建.dnx文件夹,只有两个脚本: bin\dnvm.cmd和bin\dnvm.ps1注意:这将删除所有已经安装的运行时。

重新运行dnvm upgrade并检查项目属性下的解决方案DNX SDK版本是否与安装的版本匹配。

票数 14
EN

Stack Overflow用户

发布于 2015-07-23 02:35:14

我也有这个问题。这似乎与dnvm.ps1脚本未引用安装路径的问题有关。Visual Studio中的命令dnvm install "C:\Program Files (x86)\Microsoft Web Tools\DNX\dnx-clr-win-x86.1.0.0-beta5.nupkg"被重新调用为dnvm-install C:\Program Files (x86)\Microsoft Web Tools\DNX\dnx-clr-win-x86.1.0.0-beta5.nupkg,当路径应该被引用时,该命令会断开。有关我打开的拉取请求的更多信息,请访问:

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

作为一种变通办法,我的解决方案是在"C:\Program Files\Microsoft DNX\Dnvm\dnvm.ps1“中更改以下内容。这将遍历参数,确保任何包含空格或括号的内容都被引用。

替换以下行:

代码语言:javascript
复制
$cmdargs = @($args[1..($args.Length-1)])

通过以下方式:

代码语言:javascript
复制
# 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 += " "
}

如果在进行此更改后仍有问题,请删除C:\Users\username\.dnx,然后重新打开Visual Studio以让Visual Studio重新创建该文件夹。

票数 10
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31546274

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档