Hello all,
I have a huge list of projects in the Solution Explorer in VS.NET.
There are some projects that are used to create an environment for the
main project to run. This main project has been set as the default. So
I can press F5 to run it. However, I want to write a macro for one
other project since the list is quite huge and I have to scroll down
everytime, right-click on it, select 'Debug' and then click 'New
instance'. I could sure use some automation here.
Is there any way to do this in VS.NET using macros?
Thanks in advance for your time.
bilaribilari@yahoo.com - 22 May 2006 08:38 GMT
Its ok. I figured it out myself. Here it is for someone else who may
need similar functionality:
Sub DebugApp ( ByVal name As String, ByVal currActive As String )
{
'Set the named project as curr active project and run it. Then we'll
restore it.
DTE.ExecuteCommand("View.SolutionExplorer")
DTE.ActiveWindow.Object.GetItem(name).Select(vsUISelectionType.vsUISelectionTypeSelect)
DTE.ExecuteCommand("Project.SetasStartUpProject")
DTE.Debugger.Go()
'Restore the current active project to the same value as it was
previously.
DTE.ExecuteCommand("View.SolutionExplorer")
DTE.ActiveWindow.Object.GetItem(currActive).Select(vsUISelectionType.vsUISelectionTypeSelect)
DTE.ExecuteCommand("Project.SetasStartUpProject")
}