skip to Main Content

Telegram – Decide program running as Windows service / console cmd C# .NET

Basically I already try deciding using if else like this: static async Task Main(string[] args) { string licenseKey = Environment.GetEnvironmentVariable("LICENSE_KEY"); if (string.IsNullOrEmpty(licenseKey)) { Console.WriteLine("LICENSE_KEY not found."); return; } if (args.Contains("--console") || Environment.GetEnvironmentVariable("RUN_AS_SERVICE") != "true") { Console.WriteLine("Running as console."); var cancellationTokenSource…

VIEW QUESTION
Back To Top
Search