How to resolve "Install-Package : The current environment doesn't have a solution open."

user88 picture user88 · Jan 2, 2014 · Viewed 28.5k times · Source

I have a solution having 1 project. Open Package Manager Console, run Install-Package MSBuildTasks But it gave me an error below:

Install-Package : The current environment doesn't have a solution open.
At line:1 char:16
+ Install-Package <<<<  MSBuildTasks 
    + CategoryInfo          : InvalidOperation: (:) [Install-Package], InvalidOperationExcep 
   tion
    + FullyQualifiedErrorId : NuGetNoActiveSolution,NuGet.PowerShell.Commands.InstallPackage 
   Command

I don't understand why it comes. Kindly suggest me waiting for reply. Thanks

Answer

Laughing_Jack picture Laughing_Jack · Feb 25, 2014

I usually get this error because I created or opened a project (.csproj or other) that doesn't have a saved solution (.sln) associated with it.

If you go to File->Save All it should offer to save the solution somewhere. Save it and that makes the error go away for me.