I am working on console application (.NetFramework 4.8 in VS2022) for Process Some data.
I want Send parameter when execute .exe
file from Scheduler and manually with different parameters.
its working in VS2022 LOCAL PC with Release and Debug Mode, **But **when I publish application and execute by double click or from scheduler parameter not passing to .exe file.
let me know if any Configuration missing or other way to Identify .exe file execute from scheduler or manually, in console Application Code.
Thanks.
I tried with VS2022 and VS2019 with .net framework 4.5 and 4.8,
also tried to identification using Environment.CurrentDirectory
but its not working properly.
public static void Main(string[] args)
{
try
{
Console.WriteLine($"Process Start");
if (args.Length > 0)
{
Console.WriteLine($"you passed argument {args[0]}"); // this argument value not working when Application Published
if (args.Any(X => X == "manually")) {
// execute from manually process
}
else {
// execute from scheduler process
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.WriteLine($"Process End");
Console.ReadKey();
}