My solution contains multiple projects which can be started. SometimesI would like to start a single project without using my solution startup projects settings. When I righ
Here is the the way to solve problem related to Mahin's macro
Problem description: Fourth step is creating a problem and spawns an annoying messagebox saying : The build must be stopped to change the solution property. Stop the build? 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 !
Right-Click on the project and Set it as Startup Project.
Hit Ctrl + F5
Use Start without debugging under Debug menu, or
Ctrl+F5
or you can modify the web.config file for the project:
<compilation debug="false"/>
I just put together this macro.. It's a combination of several snippets I found around the interweb. If the project is configured to run the default project output, it will find and run that. If it's configured to run a specific program, it will run that. This macro will NOT compile your application either, so you'll want to make sure it's compiled before you run the macro. At the same time, this macro doesn't suffer from the problem mentioned in Mahin's macro 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
In short no.
What you could do is bind a key to the "Set as startup project" and then bind another key to start without debugging. Then you would have to push 2 keys to start this project without debugging, but at least it'd be quicker than using the mouse...
Right-click on the solution, select Properties. Select Multiple startup projects. A combobox for each project allows you decide which projects to start without debugging.