I want to change my command-line arguments and then debug my executable.
With the default Visual Studio UI, this takes me several tortuous mouse and keyboard actions:
The extension CLIArgsMadeEasy 2010/2012 is a great little thing that puts the project's debug session's command line arguments right in a little text box on the visual studio toolbar, IMO, its alot easier and less tedious than using macros.
The Link
http://visualstudiogallery.msdn.microsoft.com/8159cd7d-2c81-47f3-9794-a347ec1fba09?SRC=VSIDE
You can just type CLIArgsMadeEasy in your search box in the extensions manager which will find it fairly quickly in the gallery, thats how I installed it, if you need to know. Hope this helps!
Macro below should help. Open "Tools->Macros->Macro Explorer", then create new module, edit it, and copy-paste code below. Required command is SetCommandArgsProperty. UI is not nice, but it works (VS 2005, I hope this will also work in VS 2010). Then add any shortcut you like to run this macro.
Here are some details:
Update property if OK is selected
Sub SetCommandArgsProperty()
Dim newVal As Object
newVal = InputValue(GetCommandArgsPropertyValue())
If TypeOf newVal Is String Then
SetCommandArgsProperty(newVal)
End If
End Sub
Function InputValue(ByVal defaultText As String)
Dim frm As New System.Windows.Forms.Form
Dim btn As New System.Windows.Forms.Button
Dim edit As New System.Windows.Forms.TextBox
edit.Text = defaultText
edit.Width = 100
btn.Text = "OK"
btn.DialogResult = System.Windows.Forms.DialogResult.OK
frm.Text = "Input command line properties"
frm.Controls.Add(btn)
btn.Dock = System.Windows.Forms.DockStyle.Bottom
frm.Controls.Add(edit)
edit.Dock = System.Windows.Forms.DockStyle.Top
frm.Height = 80
frm.Width = 300
If frm.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Return edit.Text
End If
Return System.DBNull.Value
End Function
Function GetCommandArgsProperty() As EnvDTE.Property
Dim solution As Solution
Dim project As Project
Dim sb As SolutionBuild
Dim str As String
Dim cm As ConfigurationManager
Dim config As Configuration
Dim properties As Properties
Dim prop As EnvDTE.Property
solution = DTE.Solution
sb = solution.SolutionBuild
For Each str In sb.StartupProjects
project = solution.Item(str)
cm = project.ConfigurationManager
config = cm.ActiveConfiguration
properties = config.Properties
For Each prop In properties
If prop.Name = "CommandArguments" Then
Return prop
End If
Next
Next
End Function
Function GetCommandArgsPropertyValue()
Return GetCommandArgsProperty().Value
End Function
Sub SetCommandArgsProperty(ByVal value As String)
GetCommandArgsProperty().Value = value
End Sub
At least in Visual Studio 2012, you can use Alt+F7
shortcut to directly access project properties.
Furthermore, the opened Property Pages normally remembers the last opened item, i.e. Configuration Properties -> Debugging
.