From aaee0c922813eff87a22bb5a1bb79b481b9157be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zeynep=20Gizem=20F=C4=B1rat?= Date: Thu, 10 Sep 2026 10:41:54 +0300 Subject: [PATCH] Handle missing nightly version for --include Improve CLI package update behavior when resolving the latest `Volo.Abp.Core` nightly version fails or returns empty: the `--include` pass is now skipped explicitly with a warning while normal project updates continue. Also switch file reading in `VoloNugetPackagesVersionUpdater` to use the shared `DefaultEncoding` instead of `Encoding.Default` for consistent encoding handling. --- .../Cli/ProjectModification/PackagePreviewSwitcher.cs | 10 +++++++++- .../VoloNugetPackagesVersionUpdater.cs | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackagePreviewSwitcher.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackagePreviewSwitcher.cs index 6addbd8bb8..9dfacf5431 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackagePreviewSwitcher.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackagePreviewSwitcher.cs @@ -273,7 +273,15 @@ public class PackagePreviewSwitcher : ITransientDependency // (source registration / regular PackageReference updates below must still // proceed for every solution/project) - just skip the --include pass. Logger.LogWarning(ex, "Could not resolve the latest Volo.Abp.Core nightly version; --include files will be skipped for this run."); - latestVersionFromMyGet = null; + return (includeFiles, excludedPackages, null); + } + + if (latestVersionFromMyGet.IsNullOrWhiteSpace()) + { + // No exception was thrown, but MyGet simply has no version for this package yet + // (e.g. not indexed there) - warn so users aren't left wondering why --include did nothing. + Logger.LogWarning("Could not resolve the latest Volo.Abp.Core nightly version; --include files will be skipped for this run."); + return (includeFiles, excludedPackages, null); } return (includeFiles, excludedPackages, latestVersionFromMyGet); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs index 6500674799..f9aedb29b9 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs @@ -408,7 +408,7 @@ public class VoloNugetPackagesVersionUpdater : ITransientDependency { using (var fs = File.Open(filePath, FileMode.Open, FileAccess.ReadWrite, FileShare.None)) { - using (var sr = new StreamReader(fs, Encoding.Default, true)) + using (var sr = new StreamReader(fs, DefaultEncoding, true)) { var fileContent = await sr.ReadToEndAsync();