【发布时间】:2023-03-30 18:45:01
【问题描述】:
我正在尝试使用 http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#From_a_convention_based_working_directory 创建一个 nuget 包 作为参考。 Visual Studio 中的包管理器控制台不允许我使用“nuget”命令。 我能够“获取帮助 nuguet”,它会显示:
包括以下 NuGet cmdlet。
Cmdlet Description
------------------ ----------------------------------------------
Get-Package Gets the set of packages available from the package source.
Install-Package Installs a package and its dependencies into the project.
Uninstall-Package Uninstalls a package. If other packages depend on this package,
the command will fail unless the –Force option is specified.
Update-Package Updates a package and its dependencies to a newer version.
Add-BindingRedirect Examines all assemblies within the output path for a project
and adds binding redirects to the application (or web)
configuration file where necessary.
Get-Project Returns a reference to the DTE (Development Tools Environment)
for the specified project. If none is specifed, returns the
default project selected in the Package Manager Console.
Open-PackagePage Open the browser pointing to ProjectUrl, LicenseUrl or
ReportAbuseUrl of the specified package.
Register-TabExpansion Registers a tab expansion for the parameters of a command.
- 但是,每当我使用 nuget 启动命令时,都会给出:
术语“nuget”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确并尝试 ag 是的。
在 line:1 char:6 + 核子
我尝试了以下解决方案:
1>关闭所有项目并重新启动
2>卸载并重新安装
3>创建一个 powershell 配置文件(以前不存在,这实际上破坏了一切)
在我将我的 Visual Studio 2012 Ultimate 试用版升级到注册后,问题开始出现。我最初安装了 VS 12 Pro。我不知道这是否真的与它有关,但我注意到其他有类似问题的人安装了 vs 10 和 12。
我的问题是“有人知道还有什么可以尝试的吗?”我的理论是缺少 nuget 命令的路径,但我找不到如何配置包管理器控制台使用的路径,而且我不确定 cmdlet nuget 的实际存储位置。
已更新---尝试下载命令行工具,如下所示。这导致没有任何工作再次起作用。我试图卸载,现在我在 nuget 的 vs2010 扩展中有一个项目,它没有启用安装或卸载按钮。这让我相信它与通过 2010 年和 2012 年安装的扩展程序有关,这在我的小戏剧中有一部分。如果有人也知道如何对可卸载的扩展进行核攻击,也请提出建议,但我会为此尝试另一个问题。
【问题讨论】:
-
您是否启用了 UAC 并尝试以管理员身份运行 Visual Studio 来卸载扩展?
-
Install-Package NuGet.CommandLine 是正确答案。
-
@live-love OP 正在尝试创建一个包,而不是安装一个包
-
这可能会有所帮助 - stackoverflow link
标签: visual-studio nuget-package