Debug a C# application in Visual Studio with command line arguments

To use command line arguments during debugging in Visual Studio Community Edition we will create project profiles.

Create the project profile

  • Right-click the project and select Properties
  • In the top toolbar click the small arrow next to the outlined (Start without debugging) run button and select …Debug Properties

  • In the upper right corner of the Launch Profiles window click the Create a new profile button

  • Select the Project option

  • Select the new profile and click the Rename selected profile button

  • Enter the command line argument you want to pass to the application. Ignore the warning, the application will be able to read the arguments.

  • There is no save button, close the window with the X in the upper right corner

Select the project profile

To debug the application with a specific project profile

  • In the top toolbar click the small arrow next to the outlined (Start without debugging) run button and select the project profile you want to use to debug the application

Leave a comment

Your email address will not be published. Required fields are marked *