From 423a7f34408f32e1a6233c03ab8ec8fad7f3bd50 Mon Sep 17 00:00:00 2001 From: AmirMS <104940545+AmelBawa-msft@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:29:38 -0700 Subject: [PATCH 1/5] Place dsc resource json at the root of the msix --- src/WingetCreateCLI/WingetCreateCLI.csproj | 8 -------- src/WingetCreatePackage/WingetCreatePackage.wapproj | 1 + 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/WingetCreateCLI/WingetCreateCLI.csproj b/src/WingetCreateCLI/WingetCreateCLI.csproj index 6536b6bb..c43df76f 100644 --- a/src/WingetCreateCLI/WingetCreateCLI.csproj +++ b/src/WingetCreateCLI/WingetCreateCLI.csproj @@ -102,14 +102,6 @@ - - - %(Filename)%(Extension) -    Always -    Always - diff --git a/src/WingetCreatePackage/WingetCreatePackage.wapproj b/src/WingetCreatePackage/WingetCreatePackage.wapproj index 57a3028b..8bcf5f5e 100644 --- a/src/WingetCreatePackage/WingetCreatePackage.wapproj +++ b/src/WingetCreatePackage/WingetCreatePackage.wapproj @@ -51,6 +51,7 @@ + From f993055fe219a088b567d4a4541a961821f68321 Mon Sep 17 00:00:00 2001 From: AmirMS <104940545+AmelBawa-msft@users.noreply.github.com> Date: Wed, 9 Jul 2025 17:00:46 -0700 Subject: [PATCH 2/5] Print warning to error stream --- src/WingetCreateCLI/UserSettings.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/WingetCreateCLI/UserSettings.cs b/src/WingetCreateCLI/UserSettings.cs index 5af01e26..051e4e50 100644 --- a/src/WingetCreateCLI/UserSettings.cs +++ b/src/WingetCreateCLI/UserSettings.cs @@ -175,12 +175,12 @@ public static void FirstRunTelemetryConsent() { if (!File.Exists(SettingsJsonPath)) { - Console.WriteLine(Resources.TelemetrySettings_Message); - Console.WriteLine("------------------"); - Console.WriteLine(Resources.TelemetryJustification_Message); - Console.WriteLine(Resources.TelemetryAnonymous_Message); - Console.WriteLine(Resources.TelemetryEnabledByDefault_Message); - Console.WriteLine(); + Console.Error.WriteLine(Resources.TelemetrySettings_Message); + Console.Error.WriteLine("------------------"); + Console.Error.WriteLine(Resources.TelemetryJustification_Message); + Console.Error.WriteLine(Resources.TelemetryAnonymous_Message); + Console.Error.WriteLine(Resources.TelemetryEnabledByDefault_Message); + Console.Error.WriteLine(); TelemetryDisabled = false; } } From ec2a4ff5add6307457fbd497f77b7717a90a039a Mon Sep 17 00:00:00 2001 From: AmirMS <104940545+AmelBawa-msft@users.noreply.github.com> Date: Wed, 9 Jul 2025 17:04:44 -0700 Subject: [PATCH 3/5] Added comment --- src/WingetCreateCLI/UserSettings.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/WingetCreateCLI/UserSettings.cs b/src/WingetCreateCLI/UserSettings.cs index 051e4e50..ed23b91c 100644 --- a/src/WingetCreateCLI/UserSettings.cs +++ b/src/WingetCreateCLI/UserSettings.cs @@ -175,6 +175,8 @@ public static void FirstRunTelemetryConsent() { if (!File.Exists(SettingsJsonPath)) { + // Use the error stream to ensure DSC command output remains in + // the expected format. Console.Error.WriteLine(Resources.TelemetrySettings_Message); Console.Error.WriteLine("------------------"); Console.Error.WriteLine(Resources.TelemetryJustification_Message); From 64f0f397ea76e9650b072b72af635a9de4b6b6c6 Mon Sep 17 00:00:00 2001 From: AmirMS <104940545+AmelBawa-msft@users.noreply.github.com> Date: Thu, 10 Jul 2025 08:21:56 -0700 Subject: [PATCH 4/5] addressing comments --- src/WingetCreateCLI/Program.cs | 8 ++++++-- src/WingetCreateCLI/UserSettings.cs | 14 ++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/WingetCreateCLI/Program.cs b/src/WingetCreateCLI/Program.cs index 16351c4f..9cb07bc5 100644 --- a/src/WingetCreateCLI/Program.cs +++ b/src/WingetCreateCLI/Program.cs @@ -25,7 +25,6 @@ internal class Program private static async Task Main(string[] args) { Logger.Initialize(); - UserSettings.FirstRunTelemetryConsent(); TelemetryEventListener.EventListener.IsTelemetryEnabled(); SentenceBuilder.Factory = () => new LocalizableSentenceBuilder(); Console.OutputEncoding = System.Text.Encoding.UTF8; @@ -57,13 +56,18 @@ private static async Task Main(string[] args) var parserResult = myParser.ParseArguments(args, types); BaseCommand command = parserResult.MapResult(c => c as BaseCommand, err => null); - if (command == null) { DisplayHelp(parserResult as NotParsed); DisplayParsingErrors(parserResult as NotParsed); return args.Any() ? 1 : 0; } + else if (command is not DscCommand) + { + // For DSC commands, we do not want to display the header to + // ensure the output is a valid JSON. + UserSettings.FirstRunTelemetryConsent(); + } // If the user has provided a token via the command line, warn them that it may be logged if (!string.IsNullOrEmpty(command.GitHubToken)) diff --git a/src/WingetCreateCLI/UserSettings.cs b/src/WingetCreateCLI/UserSettings.cs index ed23b91c..5af01e26 100644 --- a/src/WingetCreateCLI/UserSettings.cs +++ b/src/WingetCreateCLI/UserSettings.cs @@ -175,14 +175,12 @@ public static void FirstRunTelemetryConsent() { if (!File.Exists(SettingsJsonPath)) { - // Use the error stream to ensure DSC command output remains in - // the expected format. - Console.Error.WriteLine(Resources.TelemetrySettings_Message); - Console.Error.WriteLine("------------------"); - Console.Error.WriteLine(Resources.TelemetryJustification_Message); - Console.Error.WriteLine(Resources.TelemetryAnonymous_Message); - Console.Error.WriteLine(Resources.TelemetryEnabledByDefault_Message); - Console.Error.WriteLine(); + Console.WriteLine(Resources.TelemetrySettings_Message); + Console.WriteLine("------------------"); + Console.WriteLine(Resources.TelemetryJustification_Message); + Console.WriteLine(Resources.TelemetryAnonymous_Message); + Console.WriteLine(Resources.TelemetryEnabledByDefault_Message); + Console.WriteLine(); TelemetryDisabled = false; } } From 68dfe04a1db30d122441c1088af8ac5b6833bf6f Mon Sep 17 00:00:00 2001 From: AmirMS <104940545+AmelBawa-msft@users.noreply.github.com> Date: Thu, 10 Jul 2025 13:23:17 -0700 Subject: [PATCH 5/5] Update Program.cs --- src/WingetCreateCLI/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/WingetCreateCLI/Program.cs b/src/WingetCreateCLI/Program.cs index 9cb07bc5..27f6573a 100644 --- a/src/WingetCreateCLI/Program.cs +++ b/src/WingetCreateCLI/Program.cs @@ -62,7 +62,8 @@ private static async Task Main(string[] args) DisplayParsingErrors(parserResult as NotParsed); return args.Any() ? 1 : 0; } - else if (command is not DscCommand) + + if (command is not DscCommand) { // For DSC commands, we do not want to display the header to // ensure the output is a valid JSON.