从 Visual Studio 外部使用 NuGet PowerShell commandlet [英] Use NuGet PowerShell commandlets from outside Visual Studio

查看:56
本文介绍了从 Visual Studio 外部使用 NuGet PowerShell commandlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I was trying to use my favorite source control from the Package Manager console in Visual Studio 2010. I had issues described in another topic. For now the best answer is to move all command-line stuff from Visual Studio to bare PowerShell.

但是在这种情况下,与 Visual Studio 相关的命令行开关不起作用.例如,最重要的一个 - 我无法从 运行 Update-Database 命令实体框架.

But this case the Visual Studio related commandlets are not working. For example, most crucial one — I cannot run Update-Database command from Entity Framework.

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

Is it possible to register somehow Visual Studio specific commandlets for the current project in PowerShell? Or make PowerShell automatically take current project context from the packages subfolder?

推荐答案

NuGet PowerShell 命令依赖于从 Visual Studio 内部运行,因此在从命令行运行的普通 PowerShell 中无法在外部运行.

The NuGet PowerShell commands rely on being run from within Visual Studio so will not work outside in the normal PowerShell running from the command line.

但是,您可以使用 EntityFramework NuGet 包附带的 migrate.exe 并使用它从命令行更新您的数据库.

You can however use migrate.exe which ships with the EntityFramework NuGet package and use that from the command line to update your database.

作为原型,我整理了一种使用 NuGet PowerShell 命令的方法使用 SharpDevelop 的普通 PowerShell 命令行.不幸的是,目前 EntityFramework NuGet 包不适用于 SharpDevelop.

As a prototype I put together a way to use NuGet PowerShell commands from the normal PowerShell command line using SharpDevelop. Unfortunately at the moment the EntityFramework NuGet package does not work with SharpDevelop.

另一个有趣的项目是 StudioShell,它在 Visual Studio 内部提供了一个新的 DTE:驱动器,但也可以从命令行外部使用.我认为它不支持从普通 PowerShell 命令行运行的 NuGet PowerShell 命令.

Another interesting project is StudioShell which provides a new DTE: drive inside Visual Studio but can also be used outside from the command line. I do not believe it supports NuGet PowerShell commands being run from the normal PowerShell command line.

这篇关于从 Visual Studio 外部使用 NuGet PowerShell commandlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆