How to run a separate project without debugging in Visual Studio?

My solution contains several projects that you can run. Sometimes I would like to start one project without using the settings for launching my solution. When I right-click on a project, I can go to Debug-> Start New Instance, which launches the application using the debugger.

But I would like to start a new instance without a debugger. Is it possible?

+55
visual studio
Aug 31 '09 at 9:06
source share
13 answers

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 :))

+17
Aug 31 '09 at 11:16
source share

Add the VSCommands extension to Visual Studio, right click on the project -> Debug -> Start Without Debugging

+14
Apr 19 '13 at 10:48 on
source share

I just compiled this macro .. This is a combination of several fragments that I found around interweb. If the project is configured to start the project by default, it will find and launch it. If it is configured to run a specific program, it will run this. This macro will NOT compile your application, so you must ensure that it is compiled before running the macro. At the same time, this macro does not suffer from the problem mentioned in Machin's macromyne above.

 Sub RunActiveProjectOutput() Dim Projs As Array Dim Proj As Project Projs = DTE.ActiveSolutionProjects() If (Projs.Length > 0) Then Proj = Projs.GetValue(0) Dim action = DirectCast(Proj.ConfigurationManager.ActiveConfiguration.Properties.Item("StartAction").Value, Integer) If (action = 1) Then Dim app = Proj.ConfigurationManager.ActiveConfiguration.Properties.Item("StartProgram").Value Dim args = Proj.ConfigurationManager.ActiveConfiguration.Properties.Item("StartArguments").Value System.Diagnostics.Process.Start(app, args) Else Dim fullPath = Proj.Properties.Item("FullPath").Value.ToString() Dim outputPath = Proj.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value.ToString() Dim outputDir = System.IO.Path.Combine(fullPath, outputPath) Dim outputFileName = Proj.Properties.Item("OutputFileName").Value.ToString() Dim assemblyPath = System.IO.Path.Combine(outputDir, outputFileName) System.Diagnostics.Process.Start(assemblyPath) End If End If End Sub 
+8
Jan 13 '10 at 18:32
source share

Perhaps this is new in VS 2015, but there is no need to add a custom macro - you can find the menu item โ€œStart without debuggingโ€ in the list of things that you can add.

Go to Tools โ†’ Customize, follow the images below.

Add Add Command Here you can find the menu item

+8
Jan 07 '16 at 8:50
source share

Here's a way to solve the problem with the Machin macro

Description of the problem: The fourth step creates a problem and generates an annoying message with the message: the assembly must be stopped in order to change the property of the solution. Stop assembly? OK or Cancel.

 Public Module Custom Private WithEvents t As Timers.Timer Private Prop As EnvDTE.Property Private PrevStartup As Object Private Sub StartTimer() t = New Timers.Timer t.Interval = 0.05 t.Start() End Sub Sub t_Elapsed(ByVal ee As Object, ByVal dd As Timers.ElapsedEventArgs) Handles t.Elapsed If DTE.Solution.SolutionBuild.BuildState <> vsBuildState.vsBuildStateInProgress Then t.Stop() Prop.Value = PrevStartup End If End Sub Sub RunSelectedWithoutDebug() Dim Projs As Array Dim Proj As Project Projs = DTE.ActiveSolutionProjects() If (Projs.Length > 0) Then Proj = Projs.GetValue(0) Prop = DTE.Solution.Properties.Item("StartupProject") PrevStartup = Prop.Value Prop.Value = Proj.Name DTE.ExecuteCommand("Debug.StartWithoutDebugging") StartTimer() End If End Sub End Module 

Enjoy it!

+4
Feb 23 '11 at 23:23
source share

I tried to do the same. This is similar to the supervision of the VS team, which you can start with or without debugging at the solution level, but only with debugging at the project level.

One thing that I noticed is that if you right-click on the toolbar and select "Customize", in the pop-up action box, go to the "Project" category. There is a command "Run" and "Run Selected". Interestingly, I added both to the projectโ€™s context menu and to the main button bar, and the elements always seem to be disabled.

It is also interesting that the context menu of the "Debug | Start a new instance" project is nowhere to be found in the list of custom commands. I looked through almost every category and could not find it.

Hope someone comes up with a good way to do this ... that would be very convenient!

+3
Sep 30 '09 at 16:56
source share

Use Start Without Debugging in the Debug menu or

Ctrl + F5

or you can change the web.config file for the project:

 <compilation debug="false"/> 
+2
Aug 31 '09 at 9:11
source share

Right-click the project and set it as the startup project.

Press Ctrl + F5

+2
Aug 31 '09 at 9:13
source share

In short, no.

What you can do is associate the key with "Set as launch project", and then associate another key to start without debugging. Then you have to press 2 keys to start this project without debugging, but at least it will be faster than using the mouse ...

+2
Aug 31 '09 at 9:15
source share

I usually run the executable directly. If I need one solution without debugging mode, I usually add them to the quick launch menu somewhere on the taskbar.

+2
Aug 31 '09 at 9:23
source share

It's pretty fast: Project | Set as Homepage | Current selection. Then, depending on which project is selected, it runs under Debug | Start without debugging / Ctrl -f5. https://blogs.msdn.microsoft.com/saraford/2005/11/29/how-to-set-your-current-project-to-always-be-the-startup-project/

+2
Jul 21 '17 at 18:49
source share
  • Set the required project as Startup Project (as suggested)
  • Disable Build for all other projects in Configuration Manager Configuration.
  • Start without debugging.
0
Aug 31 '09 at 10:40
source share

Install As a launch project and press Ctrl + F5 or select the menu item "Debug" + "Start" without debugging.

-one
Aug 31 '09 at 9:10
source share



All Articles