我正在尝试创建一个NuGet包,参考http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#From_a_convention_based_working_directory。 我的Visual Studio中的包管理器控制台不允许我使用“nuget”命令。 我能够使用“Get-help nuguet”并显示以下NuGet cmdlets。
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、函数、脚本文件或可操作程序的名称。请检查名称的拼写,如果包含路径,请验证路径是否正确并重试。
在第1行第6个字符处: + nuget <<<< + CategoryInfo : ObjectNotFound: (nuget:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
我尝试了以下解决方案:
1. 关闭所有项目并重新启动。
2. 卸载并重新安装。
3. 创建一个PowerShell配置文件(这以前不存在,实际上这破坏了一切)。
这个问题在我将Visual Studio 2012 Ultimate试用版升级到注册版之后开始出现。我最初安装了VS 12 Pro。我不知道这是否真的与它有任何关系,但我注意到其他遇到类似问题的人安装了vs 10和12。
我的问题是,“还有谁知道还有什么其他方法可尝试?”我的理论是nuget命令的路径丢失了,但我找不到如何配置软件包管理器控制台使用的路径,也不确定nuget cmdlet实际上存储在哪里。
更新--尝试按照下面的建议下载命令行工具。这导致一切都不起作用了。我试图卸载,现在我在vs2010扩展中有一个关于nuget的项目,但未启用安装或卸载按钮。这让我相信,它与通过2010和2012安装的扩展有关。如果还有人知道如何删除无法卸载的扩展,请告诉我,但我会为此提出另一个问题。