.net Nuget:当前环境没有打开的解决方案

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25714557/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 12:48:23  来源:igfitidea点击:

Nuget: The current environment doesn't have a solution open

.netnugetnuget-package

提问by MrMins

I'm trying to install DeveloperForce.Web.LoginI recently updated my nuget to the version 2.8.50313.31

我正在尝试安装DeveloperForce.Web.Login我最近将我的 nuget 更新到了该版本2.8.50313.31

PM> Install-Package DeveloperForce.Web.Login
Install-Package : The current environment doesn't have a solution open.
At line:1 char:16
+ Install-Package <<<<  DeveloperForce.Web.Login
    + CategoryInfo          : InvalidOperation: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetNoActiveSolution,NuGet.PowerShell.Commands.InstallPackageCommand

回答by Simon Farshid

In the package manager console, make sure to select the default project.

在包管理器控制台中,确保选择默认项目。

If there are no choices, it means that there is no solution file created for your project. When I tested this, I was able to fix the problem by pressing Ctrl + Shift + S (Save all). Visual studio then prompted me to select a directory for my .slnfile and NuGet then successfully recognized my solution/project.

如果没有选择,则意味着没有为您的项目创建解决方案文件。当我对此进行测试时,我能够通过按 Ctrl + Shift + S(全部保存)来解决问题。Visual Studio 然后提示我为我的.sln文件选择一个目录,然后 NuGet 成功识别我的解决方案/项目。

回答by dhaval

It is simpler than you can think of!

它比你想象的要简单!

J**

J**

just do -> click on Save All under the File menu

只需执行 -> 单击“文件”菜单下的“全部保存”

** of MVS and then operate on the console manager

** MVS 然后在控制台管理器上操作

回答by Kennedy Kinyanjui

Just like Farshid said, it means that there is no solution file created for your project and in order to fix this, press Ctrl + Shift + S. Visual studio will prompt you to select a directory for your .sln file which will in turn make NuGet recognize your solution.

就像 Farshid 所说的那样,这意味着没有为您的项目创建解决方案文件,为了解决这个问题,请按 Ctrl + Shift + S。Visual Studio 将提示您为 .sln 文件选择一个目录,这将依次使NuGet 识别您的解决方案。