[英]Creating a Visual Studio 2013 extension that hosts PowerShell
Much of my build process is a collection of PowerShell scripts and functions, all defined within a .ps1
file. 我的构建过程大部分是PowerShell脚本和函数的集合,所有这些都在
.ps1
文件中定义。 I simply have a shortcut to that file on my desktop, and it launches PowerShell and initializes everything. 我在桌面上只是该文件的快捷方式,它会启动PowerShell并初始化所有内容。
Now, I think it would be handy if I could just run that shell within the Visual Studio 2013 environment. 现在,我认为如果可以在 Visual Studio 2013环境中运行该Shell会很方便。 That way, I wouldn't need to keep switching windows when I want to build, publish things to IIS, perform database provisioning, etc. Should be easy enough, right?
这样,当我要构建,将内容发布到IIS,执行数据库配置等操作时,就不需要保持切换窗口的状态。应该足够容易,对吧?
The first thing I found was PowerConsole , an extension for Visual Studio that allows users to access Power Shell from within VS. 我发现的第一件事是PowerConsole ,它是Visual Studio的扩展,允许用户从VS中访问Power Shell。 However, it only works with Visual Studio 2010. According to the author , the NuGet team basically forked his code and it's now part of the NuGet console.
但是,它仅适用于Visual Studio2010。 根据作者的说法 ,NuGet团队基本上是在分叉他的代码,现在它已成为NuGet控制台的一部分。 So, my next idea was to just use the NuGet console.
因此,我的下一个想法是仅使用NuGet控制台。 This has a few problems:
这有几个问题:
dir
, it doesn't really behave like PowerShell. dir
,但实际上它的行为并不像PowerShell。 For example, you can't change the prompt, even if you override the prompt
function. prompt
功能,也无法更改prompt
。 BuildShell.ps1
file, none of the functions within the file are registered and nothing seems to change. BuildShell.ps1
文件时,该文件中的所有功能均未注册,并且似乎没有任何变化。 Overall, this seems like a hacky way to integrate a custom build environment into Visual Studio. 总的来说,这似乎是一种将自定义生成环境集成到Visual Studio中的简单方法。 So, next step is to create my own extension.
因此,下一步是创建自己的扩展程序。 After all, that's all NuGet is, right?
毕竟,这就是NuGet的全部,对吧?
The Question: 问题:
How do you create a NuGet like extension for Visual Studio 2013? 如何为Visual Studio 2013创建类似NuGet的扩展? MSDN has quite a few Visual Studio 2013 Extension samples , however they seem to be geared around extending the editor (such as what reSharper might do) and not creating new command windows.
MSDN有很多Visual Studio 2013 Extension示例 ,但是它们似乎旨在扩展编辑器(例如reSharper可能执行的操作)并且不创建新的命令窗口。 I'm looking for something to get me started, or perhaps an open source program I can look at.
我正在寻找使我入门的东西,或者我可以看的开源程序。 Thanks!
谢谢!
您是否考虑过适用于Visual Studio的PowerShell工具 ?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.