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