visual-studio - 使用 PowerShell 打开文件

标签 visual-studio powershell automation

是否有命令可以从 Visual Studio 中的包管理器控制台(也称为 PowerShell)打开项目项(例如类文件)?当我在解决方案资源管理器中双击该文件时,也会发生同样的情况。

我尝试使用Invoke-Item,但这恰好打开了 Visual Studio 的新实例。

最佳答案

$DTE.ExecuteCommand(“File.OpenFile”, "a path to your file")

您可以通过以下方式引用本地项目文件:

$path = [System.IO.Path]
$file = $path::Combine($path::GetDirectoryName($project.FileName), “your local path”)
$DTE.ExecuteCommand(“File.OpenFile”, $file)

关于visual-studio - 使用 PowerShell 打开文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28426379/

相关文章:

visual-studio - 如何从插件读取、更新和替换 Web 测试中的 "String body"字段?

visual-studio - FileNotFoundException: "Could not load file or assembly",尽管程序集存在

regex - 从查找表中捕获要替换的正则表达式匹配项

magento - 在项目启动时自动安装常见的 magento 扩展

excel - VBA 自动执行网页抓取进入单元格

javascript - 登录后保持 session - selenium - javascript

visual-studio - Team Foundation Server - 解决方案绑定(bind)丢失

visual-studio - Visual Studio 最近的 "hungry"或 "greedy"退格行为更新?

javascript - 无法在Powershell中复制CryptoJS.enc.Hex.parse(hash)

powershell - 使用 PowerShell 从 Azure 存储帐户中删除超过 3 个月的表