How to fix DNX/DNVM in Visual Studio 2015?

后端 未结 8 908
时光取名叫无心
时光取名叫无心 2020-12-01 06:02

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 t

8条回答
  •  北荒
    北荒 (楼主)
    2020-12-01 06:43

    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.

提交回复
热议问题