Yves Schelpe
Yves Schelpe

Reputation: 3473

Make DNVM use setting global (machine)

According to the "Version Manager" documentation (dnvm, ref: https://github.com/aspnet/Home/wiki/Version-Manager) I should be able to provide the -g or -global parameter when using the command use.

Documentation:

 dnvm use <semver>|<alias>|none [-x86][-x64] [-svr50][-svrc50] [-p|-persistent] [-g|-global]

    | add DNX bin to path of current command line
    none remove DNX bin from path of current command line
    -p|-persistent add DNX bin to PATH environment variables persistently
    -g|-global combined with -p to change machine PATH instead of user PATH

Yet when I perform this, I recieve the following error:

C:\Repos\X\AbsenceRequests\AbsenceRequests\AbsenceRequests.Data.EF>dnvm use 1.0.
0-rc1-update1 -p -g
Invoke-Command : A parameter cannot be found that matches parameter name 'g'.At
 C:\Users\OSCHELPEY\.dnx\bin\dnvm.ps1:1905 char:9
+         Invoke-Command ([ScriptBlock]::Create("dnvm-$cmd $cmdargs"))
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-Command], Parameter
   BindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Comm
   ands.InvokeCommandCommand

What am I doing wrong, or am I misinterpeting the documentation?

Upvotes: 3

Views: 571

Answers (2)

Oleg
Oleg

Reputation: 222007

The options of dnvm will be changed in every beta version. You should be careful by the usage of the wiki or the documentation because the information not always corresponds to the current version of dnvm.

If you start dnvm without parameters or with the version parameter (dnvm version) you will see the current version of the .NET Version Manager. It's v1.0.0-rc2-15546 at me. If you have more old version you can update it by usage of dnvm update-self. It uses dnvm.ps1 from https://github.com/aspnet/Home/ for self updating.

You can use dnvm help use to see the options of use command of the currently installed .NET Version Manager. It's

enter image description here

on my current computer. Thus dnvm use should not support -g option.

In general dnvm use do very simple things. You can examine folders of %USERPROFILE%\.dnx\runtimes on your computer. You will see directories like dnx-clr-win-x64.1.0.0-rc1-update1, dnx-coreclr-win-x64.1.0.0-rc1-update1 and so on. Every from the directory have his own dnx.exe, like %USERPROFILE%\.dnx\runtimes\dnx-coreclr-win-x64.1.0.0-rc1-update1\bin\dnx.exe for example. dnvm use just changes the PATH of the current command line of the user's PATH:

C:\Users\Oleg>dnvm use 1.0.0-rc1-update1 -a x64 -r coreclr -p
Adding C:\Users\Oleg\.dnx\runtimes\dnx-coreclr-win-x64.1.0.0-rc1-update1\bin to process PATH
Adding C:\Users\Oleg\.dnx\runtimes\dnx-coreclr-win-x64.1.0.0-rc1-update1\bin to user PATH

C:\Users\Oleg>dnvm use 1.0.0-rc1-update1 -a x64 -r coreclr
Adding C:\Users\Oleg\.dnx\runtimes\dnx-coreclr-win-x64.1.0.0-rc1-update1\bin to process PATH

The switch -g exist for example for dnvm install. You can verify that you don't have some dnx version or uninstall it and then you can install the version using -g switch.

enter image description here

For example

C:\Windows\System32>dnvm uninstall 1.0.0-rc1-final
Removed 'C:\Users\Oleg\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-final'

C:\Windows\System32>dnvm install 1.0.0-rc1-final -g
Downloading dnx-clr-win-x86.1.0.0-rc1-final from https://www.nuget.org/api/v2
Installing to C:\ProgramData\Microsoft DNX\runtimes\dnx-clr-win-x86.1.0.0-rc1-final
Adding C:\ProgramData\Microsoft DNX\runtimes\dnx-clr-win-x86.1.0.0-rc1-final\bin to process PATH

You will see that the DNX will be installed in %ProgramData%\Microsoft DNX\runtimes instead of %USERPROFILE%\.dnx\runtimes.

Thus dnvm really support -g switch, but not for dnvm use.

Upvotes: 4

Ian Auty
Ian Auty

Reputation: 857

You haven't piped the PATH of DNX which the docs specify you must do in order to add the machine PATH. Please try this and tell us if this doesn't work.

Upvotes: -1

Related Questions