vsopen 0.1.2
dotnet tool install --global vsopen --version 0.1.2
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
dotnet tool install --local vsopen --version 0.1.2
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=vsopen&version=0.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package vsopen --version 0.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
vsopen
从任意目录打开 .NET 解决方案(.sln / .slnx / .slnf)到 Visual Studio 的命令行工具。自动通过 vswhere 定位 Visual Studio 实例。
安装
dotnet tool install -g vsopen
安装后即可全局使用命令 vsopen。
包地址:https://www.nuget.org/packages/vsopen/
用法
# 在当前目录递归查找解决方案,用最新 VS 打开
vsopen
# 指定目录
vsopen D:\code\myapp
# 指定 VS 版本(支持 latest / preview / 2022 / 2026 / 17 / 18)
vsopen --vs 2022
vsopen -v preview
# 多个解决方案时默认弹窗选择(图形候选列表);直接选第 1 个跳过交互(CI 友好)
vsopen --pick 1
# 不弹窗,用命令行数字选择
vsopen --no-gui
# 只列出找到的解决方案,不打开
vsopen --list
# 只打印将执行的命令,不启动 VS
vsopen --dry-run
选项
| 选项 | 说明 |
|---|---|
[directory] |
要搜索的根目录,默认当前目录。 |
-v, --vs <别名> |
VS 实例别名:latest(默认) / preview / 2022 / 2026 / 17 / 18。 |
--prerelease |
允许选择预览版 VS 实例。 |
--no-recursive |
只搜根目录顶层,不递归。 |
-l, --list |
只列出找到的解决方案文件,不打开。 |
--dry-run |
只打印将执行的命令,不启动 VS。 |
--pick <N> |
多个解决方案时直接选第 N 个(从 1 开始),跳过交互。 |
--no-gui |
多个解决方案时用命令行数字选择,不弹窗(无桌面 / CI 友好)。 |
--version |
显示版本。 |
-h, --help |
显示帮助。 |
默认递归查找,并忽略 .git / .vs / bin / obj / node_modules 等目录。
退出码
| 码 | 含义 |
|---|---|
| 0 | 成功 |
| 1 | 参数错误或启动失败 |
| 2 | 未找到解决方案文件 |
| 3 | 未找到 vswhere.exe |
| 4 | 未找到匹配的 Visual Studio 实例 |
说明
- 多个解决方案时默认弹出图形选择窗口(内置
vsopen-picker.exe),每个解决方案一个按钮、单击即打开,点 x / Esc 取消本次操作;可用--no-gui改为命令行数字选择。弹窗器需 .NET Desktop Runtime,缺失时当作取消。 - 工具自带 vswhere.exe(随包分发),不依赖系统是否安装 Visual Studio Installer,运行时从工具自身目录调用。
- 工具只选择带
devenv.exe且文件确实存在的 VS 实例,自动排除 BuildTools 等无 IDE 的安装和损坏实例。 latest取版本最新的实例;--vs <年份或主版本>按版本过滤后取最新。
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.