dnx icon indicating copy to clipboard operation
dnx copied to clipboard

'dnu install <package-name>' throws error in some scenarios

Open kichalla opened this issue 11 years ago • 1 comments

From within the project directory: Does not work:

  1. dnu install Microsoft.AspNet.Diagnostics.Elm
  2. dnu install Microsoft.AspNet.Diagnostics.Elm 1.0.0-beta5

Works:

  1. dnu install Microsoft.AspNet.Diagnostics.Elm 1.0.0-beta5 . (notice the .)

Following is the help info for dnu help install:

C:\Users\kichalla\Desktop\TestAppPackaging\src\TestAppPackaging [master +0 ~1 -0]> dnu help install
Microsoft .NET Development Utility CLR-x86-1.0.0-beta5-12087
Usage: dnu install [arguments] [options]
Arguments:
  [name]     Name of the dependency to add
  [version]  Version of the dependency to add, default is the latest version.
  [project]  Path to project, default is current directory

Instead of mentioning project path in the end of the arguments list, I would prefer it as the first argument so that I am not forced to supply the version number of the nuget package and just get the latest package.

Error:

C:\\TestAppPackaging\src\TestAppPackaging [master]> dnu install Microsoft.AspNet.Diagnostics.Elm
Microsoft .NET Development Utility CLR-x86-1.0.0-beta5-12087

  CACHE https://www.nuget.org/api/v2/
  CACHE https://www.myget.org/F/aspnetbeta5/api/v2/
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.AspNet.Diagnostics.Elm'
  CACHE https://www.myget.org/F/aspnetbeta5/api/v2/FindPackagesById()?id='Microsoft.AspNet.Diagnostics.Elm'
Microsoft.AspNet.Diagnostics.Elm.1.0.0-beta5 was added to project.json.
System.ArgumentNullException: Value cannot be null.
Parameter name: path
   at System.IO.Path.GetFullPathInternal(String path)
   at System.IO.Path.GetFullPath(String path)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Linq.Enumerable.<DistinctIterator>d__1`1.MoveNext()
   at Microsoft.Framework.PackageManager.RestoreCommand.<Execute>d__75.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.Framework.PackageManager.InstallCommand.<ExecuteCommand>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Framework.PackageManager.InstallConsoleCommand.<>c__DisplayClass0_0.<<Register>b__1>d.MoveNext()

kichalla avatar Jun 18 '15 02:06 kichalla

I've noticed the same thing; I think if you run dnu install Microsoft.AspNet.Diagnostics.Elm, you'll notice that the install process managed to modify project.json before crashing. That means running dnu restore immediately after that will finish the job successfully. So at least there's a quick-ish workaround in the meantime.

jbatte47 avatar Jul 05 '15 23:07 jbatte47