title: Why does my .NET Core 6 console app not want to run in CLI?
body: <p>[Background Information]</p>
  <p>So I installed the new Visual Studio 2022 and decided to try out .NET Core 6 for a simple script. Firstly, I created a new console app and was immediately confused. No main method, with no write up in the documentation to using CLI arguments (I need to pass two target path arguments). I found a overflow post regarding how to access arguments through the System.Environment class. So I moved on.</p>
  <p>[Question]</p>
  <p>In .NET Core 5 console apps I had no problem running compiled executables with arguments through the CLI. But when I published my code and ran it through the command line I got the following output (see output) with the strange line &quot;program cannot run in DOS mode&quot;. Interestingly enough, it still reads one of ini files, but when I run through powershell it reads the other ini. This is very strange behavior to me. Should I just downgrade back to .NET Core 5 or try and understand what's happening? Is it the fact that I am reading INI's ? (unfortunately I have no choice as its a legacy project). Any help is appreciated.</p>
  <p>[Code]</p>
  <pre><code>using System.IO;
  //get command line arguments
  try
  {
      string stationIniPath = Environment.GetCommandLineArgs()[0];
      string equipmentIniPath = Environment.GetCommandLineArgs()[1];
      Console.WriteLine(&quot;- Reading INI data -&quot;);
      if(stationIniPath != null &amp;&amp; equipmentIniPath != null){
          string[] stationINI = System.IO.File.ReadAllLines(stationIniPath);
          string[] equipmentINI = System.IO.File.ReadAllLines(equipmentIniPath);
          foreach(string station in stationINI)
          {
              Console.WriteLine(station);
          }
          foreach(string equipment in equipmentINI)
          {
              Console.WriteLine(equipment);
          }
      }
      else
      {
          throw new Exception(&quot;Need to specify command line arguments&quot;);
      }
  
  
  }
  catch (Exception e)
  {
      Console.WriteLine(&quot;You must specify arguments [0] Station INI Path and [1] Equipment INI path :   &quot; + e.Message);
  }
  </code></pre>
  <p>[Output When Ran using Powershell &amp; || CMD]
  <a href="https://i.stack.imgur.com/Q6Uk4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Q6Uk4.png" alt="CLI output" /></a></p>