![](/img/trans.png)
[英]How to update .sln (solution) file within Visual Studio 2019
[英]Run SLN file (visual studio solution) from win form application
我在ContextMenuStrip中有一個解決方案項列表,我想運行選定的項。
我設置了一個鼠標事件,並且具有目錄+文件名的完整路徑。
我想運行該文件,這將在Visual Studio上將其打開。
我試圖用
Process.Start(pathAndFileName);
當pathAndFileName = D:\\ Code \\ MyRepoName \\ Solutions \\ TEST \\ TEST_1.sln
這將打開Windows 10選擇程序以運行該文件,並且Visual Studio不在列表中,但已設置為該文件的默認程序。
private void ContextMenuStrip2_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
string pathAndFileName = ((ToolStripMenuItem)e.ClickedItem).ToString();
Process.Start(pathAndFileName);
}
您將需要啟動Visual Studio(devenv.exe)並將解決方案作為參數提供,例如:
devenv.exe path\to\your\solution.sln
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.