Passing command line parameters with Visual Studio C#

Command Line Arguments can be set in the Debug tag in the project’s Properties window:

enter image description here

Alternatively, there is an option to add StartArguments element to your .csproj.user file:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PublishUrlHistory />
    <InstallUrlHistory />
    <SupportUrlHistory />
    <UpdateUrlHistory />
    <BootstrapperUrlHistory />
    <ErrorReportUrlHistory />
    <FallbackCulture>en-US</FallbackCulture>
    <VerifyUploadedFiles>false</VerifyUploadedFiles>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
    <StartArguments>Argument1 Argument2</StartArguments>   <<== THIS LINE
  </PropertyGroup>
</Project>

Leave a Comment