如何解决“Install-Package : 当前环境没有打开的解决方案". [英] How to resolve "Install-Package : The current environment doesn't have a solution open."

查看:518
本文介绍了如何解决“Install-Package : 当前环境没有打开的解决方案".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含 1 个项目的解决方案.打开包管理器控制台,运行 Install-Package MSBuildTasks但它给了我以下错误:

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

推荐答案

我通常会收到此错误,因为我创建或打开的项目(.csproj 或其他)没有关联的已保存解决方案 (.sln).

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.

这篇关于如何解决“Install-Package : 当前环境没有打开的解决方案".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆