I have what seems to be a simple problem that I can't solve myself. I have a WinForm app, with main method modified to accept command line arguments like this:
[STAThread]
static void Main(String[] args)
{
int argCount = args.Length;
}
This code works fine and argCount is equals to 2 when compiled in debug mode with the following execution line: program.exe -file test.txt. However as soon as I compile the program in release mode, argCount is now 1 with the same command line arguments. The only argument contains "-file test.txt". More than that it only happens if I run the compiled executable from obj/Release folder, but not from bin/Release. Unfortunately setup project takes executables from obj/Release so I can't change that. Is this a known issue and is there a way around this problem?