gpt4 book ai didi

visual-studio-2010 - 从 Visual Studio 外部使用 NuGet PowerShell 命令行开关

转载 作者:行者123 更新时间:2023-12-03 07:51:31 29 4
gpt4 key购买 nike

我试图在 Visual Studio 2010 的包管理器控制台中使用我最喜欢的源代码控制。我在另一个 topic 中描述了问题。 .目前最好的答案是将所有命令行内容从 Visual Studio 移动到裸 PowerShell。

但在这种情况下,Visual Studio 相关的命令行开关不起作用。例如,最关键的一个——我无法运行 Update-Database来自 Entity Framework 的命令.

是否可以在 PowerShell 中以某种方式为当前项目注册 Visual Studio 特定的命令行开关?或者使 PowerShell 自动从 packages 获取当前项目上下文。子文件夹?

最佳答案

我可以在以下位置找到 NuGet.psd1 文件:
C:\Program Files (x86)\Microsoft Visual Studio
12.0\Common7\IDE\Extensions\5ttpefif.3mk\Modules\NuGet\NuGet.psd1.

但是,当您尝试加载它时:

PS> Import-Module $pathToNuGetPsd1 -Force -NoClobber -Scope Global
Import-Module : The name of the current Windows PowerShell host is: 'ConsoleHost'.
The module 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\
Extensions\5ttpefif.3mk\Modules\NuGet\NuGet.psd1' requires the following Windows
PowerShell host: 'Package Manager Host'.

我认为我们不走运。它必须从包管理器主机运行,并且需要来自 Visual Studio 的东西,如 Matt 所述。

为了解决我的问题,我使用 Chocolatey 安装 NuGet.CommandLine,然后使用 NuGet.bat 来完成我需要的操作。它需要做更多的工作,并且可能并非在所有情况下都有效,具体取决于您要执行的操作。

巧克力味: https://github.com/chocolatey/chocolatey/wiki/Installation

NuGet.命令行:
PS> cinst NuGet.CommandLine

关于visual-studio-2010 - 从 Visual Studio 外部使用 NuGet PowerShell 命令行开关,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12884282/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com