I have a WPF application that takes command line arguments and in some cases returns an exit value without starting the App. I have replaced the entry point as in this question Replacing the WPF entry point. When I run in Visual Studio without an argument it launches my App as expected. When I supply an argument it all looks good I get a line telling me "The program XXX has exited with code 66"
When I then run from the CMD command line without an argument it launches the app as expected. When I supply an argument and look at %ERRORLEVEL% I get an exit code of 0 not 66. What gives here ?
namespace WpfApplication2
{
public class EntryPoint
{
[STAThread]
public static void Main(string[] args)
{
if (args.Count > 0)
{
Environment.Exit(66);
}
App.Main();
}
}
public partial class App : Application
{
}
}