title: Nuget - Object reference not set to an instance of an object
body: <p>I have a problem with nuget package manager in vs 2015.
  Some packages like Unity has been installed with no problem.
  Some packages like EF had problems while installing. 
  Some packages like Automapper had the same problem but when I installed another version of this package, It installed fine.</p>
  
  <p>here is the output:</p>
  
  <pre><code>System.NullReferenceException: Object reference not set to an instance of an object.
  
  
  at NuGet.Protocol.Core.v3.GlobalPackagesFolderUtility.&lt;AddPackageAsync&gt;d__1.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`1.GetResult()
     at NuGet.Protocol.Core.v3.DownloadResourceV3.&lt;GetDownloadResourceResultAsync&gt;d__4.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 NuGet.PackageManagement.PackageDownloader.&lt;GetDownloadResourceResultAsync&gt;d__1.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 NuGet.PackageManagement.NuGetPackageManager.&lt;ExecuteNuGetProjectActionsAsync&gt;d__42.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at NuGet.PackageManagement.NuGetPackageManager.&lt;ExecuteNuGetProjectActionsAsync&gt;d__42.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 NuGet.PackageManagement.UI.UIActionEngine.&lt;ExecuteActionsAsync&gt;d__5.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 NuGet.PackageManagement.UI.UIActionEngine.&lt;PerformActionAsync&gt;d__3.MoveNext()
  ========== Finished ==========
  </code></pre>