Browse Source

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.
pull/26109/head
Zeynep Gizem Fırat 1 month ago
parent
commit
c217d58f2e
  1. 10
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackagePreviewSwitcher.cs
  2. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs

10
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 // (source registration / regular PackageReference updates below must still
// proceed for every solution/project) - just skip the --include pass. // 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."); 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); return (includeFiles, excludedPackages, latestVersionFromMyGet);

2
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 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(); var fileContent = await sr.ReadToEndAsync();

Loading…
Cancel
Save