Enviroment.GetCommandLineArgs()[0] is a .dll file insted of of an .exe file

Viewed 89

According to the documentation of this method, the first element of the returned string array should be the file name of the executing program, in other words, the .exe file, but if I execute the following code:

using System;

namespace main_namespace
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write(Environment.GetCommandLineArgs()[0]);
        }
    }
}

I get this output: C:\Code\C#\command_line_args_test\bin\Debug\netcoreapp3.1\command_line_args_test.dll

What is happening, shouldn't I get this: C:\Code\C#\command_line_args_test\bin\Debug\netcoreapp3.1\command_line_args_test.exe

0 Answers
Related