[英]Run SLN file (visual studio solution) from win form application
I have a list of solutions items in ContextMenuStrip and I want to run selected one. 我在ContextMenuStrip中有一个解决方案项列表,我想运行选定的项。
I have a mouse event set and I have the full path of the directory + file name. 我设置了一个鼠标事件,并且具有目录+文件名的完整路径。
I want to run the file and that will open it on visual studio. 我想运行该文件,这将在Visual Studio上将其打开。
I tried to use the action of 我试图用
Process.Start(pathAndFileName);
when the pathAndFileName = D:\\Code\\MyRepoName\\Solutions\\TEST\\TEST_1.sln 当pathAndFileName = D:\\ Code \\ MyRepoName \\ Solutions \\ TEST \\ TEST_1.sln
this will open the windows 10 select program to run for file and Visual Studio is not in the list, but yet is set to be default for this files. 这将打开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.