简体   繁体   English

有没有一种方法可以使VS Package Manager命令在Powershell控制台上可用?

[英]Is there a way to make the VS Package Manager commands available on Powershell Console?

Is there a way to make the VS Package Manager commands available on Powershell Console? 有没有一种方法可以使VS Package Manager命令在Powershell控制台上可用? I looked over this link but I was unable to understand the NuGet philosophy. 我查看了此链接,但无法理解NuGet的原理。

I know that I can access it in Visual Studio but, let me explain my approach and goal. 我知道我可以在Visual Studio中访问它,但让我解释一下我的方法和目标。

I want to learn F# and for this use a lot its REPL. 我想学习F#,为此需要大量使用REPL。 So basicaly, I open a Powershell console, change to my working folder, create a file with some code, fire the REPL, try various things. 因此,基本上,我打开Powershell控制台,转到我的工作文件夹,使用一些代码创建文件,启动REPL,尝试各种操作。

In this kind of loop makes sense to have means to install various packages without starting VS and having to create a VS project. 在这种循环中,有意义的是无需安装VS而无需创建VS项目即可安装各种软件包。

Thanks! 谢谢!

Please refer to below screenshots: 请参考以下屏幕截图:

安装Nuget软件包管理器

在PowerShell中验证

The problem is that the PowerShell cmdlets that NuGet makes available inside Visual Studio rely heavily on Visual Studio so they are not supported outside of Visual Studio from the command line. 问题是NuGet在Visual Studio中提供的PowerShell cmdlet严重依赖Visual Studio,因此从命令行在Visual Studio外部不支持它们。

From the command line you have NuGet.exe which supports the following which are project related: 在命令行中,您具有NuGet.exe,它支持以下与项目相关的项目:

  1. Downloading NuGet packages. 正在下载NuGet软件包。 Basically restoring the missing NuGet packages as defined in a packages.config file. 基本上恢复packages.config文件中定义的缺少的NuGet软件包。 NuGet.exe install or NuGet.exe restore NuGet.exe installNuGet.exe restore
  2. Updating a NuGet package in a project. 在项目中更新NuGet软件包。 This will update the reference information but not run PowerShell scripts. 这将更新参考信息,但不会运行PowerShell脚本。 NuGet update

Having the NuGet PowerShell cmdlets available on the command line is something I have looked at doing using the cmdlets that SharpDevelop provides . 我已经看过使用SharpDevelop提供cmdlet在命令行上提供NuGet PowerShell cmdlet的情况。 It is possible to fully support NuGet install/update/uninstall and have the PowerShell scripts execute on the project but in this case it requires an entire IDE, in this case SharpDevelop, to be available, at least its assemblies, even though the IDE is not run. 可以完全支持NuGet的安装/更新/卸载并在项目上执行PowerShell脚本,但是在这种情况下,它需要一个完整的IDE(在这种情况下为SharpDevelop)可用,至少是其程序集可用,即使IDE是不跑。 This is needed to support updating the project file using the Visual Studio project model (EnvDTE) from within any PowerShell scripts that run. 这是支持从运行的任何PowerShell脚本中使用Visual Studio项目模型(EnvDTE)更新项目文件所必需的。

Nuget commands cannot be used outside of Visual Studio. Nuget命令不能在Visual Studio外部使用。 However, if you were change to use Paket instead of Nuget, then you can use Paket from a command line outside of Visual Studio to manage your project's packages. 但是,如果更改为使用Paket代替Nuget,则可以从Visual Studio外部的命令行使用Paket来管理项目的程序包。

The getting started page is here . 入门页面在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 程序包管理器控制台上的PowerShell版本 - PowerShell Version on Package Manager Console 创建自己的Package Manager控制台命令? - Create own Package Manager Console commands? 列出程序包管理器控制台中的可用CmdLets - List available CmdLets in Package Manager Console NuGet包管理器控制台无法加载PowerShell - NuGet Package Manager Console unable to load PowerShell 没有PowerShell访问权限的Package Manager控制台命令 - Package Manager console command without PowerShell access 从Powershell命令提示符启动VS2012包管理器控制台 - Start VS2012 Package Manager Console from Powershell Command Prompt 如何使用PowerShell更改VS Package Manager控制台的前景色? - How do you change the foreground color of the VS Package Manager Console with PowerShell? Powershell无法在VS 2013 Package Manager控制台中找到其dll或依赖项 - Powershell fails to find its dll or dependency in VS 2013 Package Manager Console 在 NuGet 包管理器控制台中列出特定包的所有可用版本 - List all available versions of a specific package in NuGet Package Manager Console 在扩展中以编程方式访问visual studio的powershell控制台(包管理器控制台) - Access the powershell console (package manager console) of visual studio programmatically in an extension
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM