Program Tip

Visual Studio 2015에서 DNX / DNVM을 수정하는 방법은 무엇입니까?

programtip 2020. 12. 12. 12:17
반응형

Visual Studio 2015에서 DNX / DNVM을 수정하는 방법은 무엇입니까?


오늘 저는 Windows 7 x64에 VS 2015를 설치했습니다. 주로 새로운 .Net Core 기능 등을 테스트하기 위해 테스트를 위해 새로운 C # "콘솔 애플리케이션 (패키지)"솔루션을 만들고 다음 메시지를 받았습니다.

DNX SDK 버전 'dnx-clr-win-x86.1.0.0-beta5'를 설치하지 못했습니다. 이 솔루션은이 세션에 DNX SDK 버전 'dnx-clr-win-x86.1.0.0-beta5'를 사용합니다.

프로젝트를 컴파일하고 디버그 할 수 없습니다. 또한 프로젝트 속성에서 디버그 탭을 열면 VS가 충돌했습니다.

솔루션을 열 때 DNVM 출력 :

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

그것을 고치는 방법에 대한 아이디어가 있습니까?

또한 이전에 VS 2015 Preview와 DNX / DNVM을 별도로 설치했습니다. 하지만 VS 2015 설치 전에 완전히 제거했다고 생각합니다. 이것이 현재 VS 설치에 어떤 영향을 미칠 수 있습니까?


이것은 알려진 문제 입니다.

ASP.NET 5 : Windows 7 SP1에서 DNX SDK는 Powershell 3.0없이 설치할 수 없습니다.

조짐

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 버전을 보려면 $PsVersionTablecommand ( details )를 실행 하십시오 .

연결:


콘솔을 열고 다음을 실행 하여 최신 버전설치하십시오 .

dnvm upgrade

VS를 다시 열면 컴파일 할 수 있습니다.

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.


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.


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.!


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.


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!


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.


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

참고URL : https://stackoverflow.com/questions/31546274/how-to-fix-dnx-dnvm-in-visual-studio-2015

반응형