Install-Package : The current environment doesn't have a solution open.

Posted by Blake on 1/5/2015
)

Scenario:

While trying to install a nuget package in Visual Studio you receive the following error:

Install-Package : The current environment doesn't have a solution open.
At line:1 char:1

+ Install-Package <PackageName>
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetNoActiveSolution,NuGet.PowerShell.Commands.InstallPackageCommand

Solution:

This typically occurs when the solution file hasn't been saved yet. A common use case would be starting Visual Studio, creating a new project and then trying to add the NuGet package before the solution has been saved the first time. To fix the issue, force save the solution, choose your destination location and then try to re-add your nuget package.