If you are interested in a permanent solution, I wrote a small macro for this task. It performs the following actions:
- Returns the currently selected project (it will use the first selected project if you select multiple projects.)
- Saves the current startup project.
- Sets the currently selected project as a startup project and launches the currently selected project in "Start without debugging" mode.
- Restores the initial launch project as a launch.
Below is the macro I wrote and the procedure for doing this.
How to write a macro: First of all, you need to go to Visual Studio Tools โ Macros โ Macro Explorer. Once you got this right click on MyMacros and create a new module (I called it CollapseAll).
Now edit the new module (double click on it), delete everything that is there, and paste this material into it.
Sub RunSelectedWithoutDebug() Dim Projs As Array Dim Proj As Project Projs = DTE.ActiveSolutionProjects() If (Projs.Length > 0) Then Proj = Projs.GetValue(0) Dim Prop As EnvDTE.Property Prop = DTE.Solution.Properties.Item("StartupProject") Dim PrevStartup As Object PrevStartup = Prop.Value Prop.Value = Proj.Name DTE.ExecuteCommand("Debug.StartWithoutDebugging") Prop.Value = PrevStartup End If End Sub
How to associate a macro with a keyboard shortcut: To do this, you need to go to Tools โ Options โ Environment โ Keyboard. Select your macro from the Box list with all the VS files by default (remember that it will be there like MyMacros.Module1.RunSelectedWithoutDebug), and then assign it a hotkey combination or chord and save it.
Note: The fourth step creates a problem and generates an annoying message that says: The line must be stopped to change the property of the solution. Stop assembly? OK or Cancel. I used to click Ok for a while. If you have no problems, if the macro sets the currently selected project as a launch project, than comment on the last line of the macro Prop.Value = PrevStartup, placing "at the beginning of the line". Now the message will not appear.
I study it and publish the updated macro as soon as I resolve it (if I can :))
Mahin Aug 31 '09 at 11:16 2009-08-31 11:16
source share