Will the value entered in "command line arguments" under start options be actually passed on as command line arguments to the executable in the release configuration or is it only a debug thing.
The question is, will it be part of the executable when deployed?
which ends up in the csproj file as shown below
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartArguments>-blah</StartArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<StartArguments>-blah</StartArguments>
</PropertyGroup>
</Project>
CodePudding user response:
using System;
namespace ConsoleApp2 {
internal class Program {
static void Main (string[] args) {
if (args.Length == 0)
Console.WriteLine("Please enter a numeric argument.");
else
foreach (string arg in args)
{
Console.WriteLine(arg);
}
Console.ReadLine();
}
}
}
using System;
namespace ConsoleApp2 {
internal class Program {
static void Main (string[] args) {
if (args.Length == 0)
Console.WriteLine("Please enter a numeric argument.");
else
foreach (string arg in args)
{
Console.WriteLine(arg);
}
Console.ReadLine();
}
}
}
exe:
When running independently: the following output:



