Add CPM include support to switch-to-nightly - #26109
Conversation
Extend `switch-to-nightly` with `--include` and `--exclude-packages` options to optionally update Central Package Management files (like `Directory.Packages.props`) alongside regular project/package updates. The updater now resolves the nightly ABP version once, updates `PackageVersion Include="Volo.*"` entries with exclusion and LeptonX/Studio safeguards, and logs/continues on MyGet or file-write failures. Also fixes `.npmrc` registry appending to insert a newline before the added registry entry.
There was a problem hiding this comment.
Pull request overview
Extends the switch-to-nightly flow in the ABP CLI to optionally update Central Package Management (CPM) version declarations (e.g., Directory.Packages.props) alongside existing per-project PackageReference and npm updates.
Changes:
- Add
--includeand--exclude-packagesparsing to run an opt-in CPM update pass after the nightly switch completes. - Implement CPM
<PackageVersion Include="Volo.*" Version="...">stamping with LeptonX/Studio safeguards and per-package exclusions. - Fix
.npmrcregistry appending to always insert a newline before the added entry.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs | Adds CPM props updating and refactors LeptonX/Studio detection helpers; exposes MyGet version resolution for reuse. |
| framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackagePreviewSwitcher.cs | Wires --include/--exclude-packages into switch-to-nightly and runs the CPM pass after solution/project updates. |
| framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs | Ensures .npmrc registry appends start on a new line. |
| framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchToNightlyCommand.cs | Updates CLI usage text to document the new options. |
Suppressed comments (1)
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs:455
- The file is read with BOM detection, but the write uses DefaultEncoding instead of the detected sr.CurrentEncoding. This can change the file’s encoding/BOM unexpectedly when updating central package files. Write back using sr.CurrentEncoding to preserve the original encoding as much as possible.
using (var sw = new StreamWriter(fs, DefaultEncoding))
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| string latestVersionFromMyGet; | ||
| try | ||
| { | ||
| latestVersionFromMyGet = await _nugetPackagesVersionUpdater.GetLatestVersionFromMyGet("Volo.Abp.Core"); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| // Don't let a transient MyGet failure abort the whole switch-to-nightly run | ||
| // (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, latestVersionFromMyGet); |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #26109 +/- ##
==========================================
- Coverage 49.80% 49.77% -0.04%
==========================================
Files 3833 3833
Lines 134158 134259 +101
Branches 10169 10187 +18
==========================================
+ Hits 66820 66830 +10
- Misses 65316 65408 +92
+ Partials 2022 2021 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
yagmurcelk
left a comment
There was a problem hiding this comment.
H-1 — --include whitespace’li Include’u kaçırır, OuterXml ile bozar
| Repo | abp CLI |
| Sev | P0 |
| Dosya | VoloNugetPackagesVersionUpdater.UpdateCentralPackageVersionsAsync |
Beklenen: --include Directory.Packages.props içindeki her Volo.* PackageVersion aynı nightly’ye çekilir. Include değeri tek satır kalır.
Gerçek: XPath //PackageVersion[starts-with(@Include, 'Volo.')] Include \r\nVolo. ile başlarsa eşleşmez. Güncelleme atlanır. Sonra doc.OuterXml CRLF’i attribute’a 
 yazar.
abp.io kanıtı (Directory.Packages.props):
<PackageVersion Include="
Volo.Abp.BlobStoring.Azure
" Version="10.8.0-preview20260825" />Komşu paketler 10.8.0-preview20260901. Restore yeşil; obj/project.assets.json → volo.abp.blobstoring.azure/10.8.0-preview20260825.
Test: Fixture’da Include’u satır kırıklı yaz, komutu çalıştır. Include entity olmamalı, Version nightly olmalı.
vs-internal geçici düzeltme (CLI’yi kapatmaz):
<PackageVersion Include="Volo.Abp.BlobStoring.Azure" Version="10.8.0-preview20260901" />H-2 — MyGet hata catch’i sadece --include resolve’da; UpdateSolutionAsync yine throw eder
| Repo | abp CLI |
| Sev | P1 |
| Dosya | PackagePreviewSwitcher |
Beklenen (c217d58f2e): MyGet’ten nightly alınamazsa --include skip, uyarı, komut devam.
Gerçek: ResolveNightlyIncludeContextAsync catch ediyor. Hemen ardından UpdateSolutionAsync(..., includePreviews: true) aynı GetLatestVersionFromMyGet’i try/catch’siz çağırır. MyGet throw → tüm switch-to-nightly abort.
Test: MyGet’i blokla. Beklenen: uyarı + devam. Kırılma: unhandled exception.
H-3 — --include yazarken props önce truncate ediliyor
| Repo | abp CLI |
| Sev | P1 |
| Dosya | UpdateCentralPackageVersionsAsync |
Beklenen: Yazma/kill/disk full’da dosya eski haliyle kalır veya net error; 0 byte olmaz.
Gerçek: fs.SetLength(0) sonra WriteAsync(doc.OuterXml). Catch error logluyor; truncate write’tan önce. Kod yorumu da bunu söylüyor.
Test: Props’u kilitle veya komutu yazma anında öldür; dosya boyutu 0 olmamalı.
H-4 — Nuget.Web.Tests: iki NuGetPackageTarget, kullanılmayan CLI using
| Repo | vs-internal |
| Sev | P1 |
| Dosyalar | AbpIoPackageAccessibilityChecker_Tests.cs, AbpIoDatabasePackageSearchService_Tests.cs |
Beklenen: NuGetPackageTarget tek anlam; CS0104 yok.
Gerçek: Volo.Abp.Cli.Core PackageReference olunca CLI enum derlemeye girdi. İki using var. İsimler FQ yazıldığı için şu an build geçiyor. using Volo.Abp.Cli.ProjectModification; kullanılmıyor.
Test: FQ’yu NuGetPackageTarget.Domain yap → CS0104. Unused using’i sil; Domain enum kalsın.
H-5 — Telemetry.Simulator: HintPath DLL yok (MSB3245)
| Repo | vs-internal |
| Sev | P1 |
| Dosya | Volo.AbpIo.Telemetry.Simulator.csproj |
Beklenen: Assembly restore/build ile gelir. CI’de volo bin\Debug yok.
Gerçek:
<HintPath>..\..\..\..\..\volo\abp\account\src\Volo.Abp.Account.Pro.Admin.Application\bin\Debug\net9.0\Volo.Abp.Account.Pro.Admin.Application.dll</HintPath>Proje net10.0. dotnet build → MSB3245, exit 0. CPM’de aynı paket zaten var (Volo.Abp.Account.Pro.Admin.Application).
Test: volo account’u build etmeden dotnet build Simulator; log’da MSB3245 olmamalı. Simulator’ı çalıştır.
H-6 — Admin: toastr paketi yok; welcome-email / activate toast patlıyor
| Repo | abp (dev UI cleanup, nightly ile gelir) + vs-internal Admin.Web |
| Sev | P1 |
| ABP | c7dedfd522 — Remove orphan jquery-form and toastr npm packages |
| Dosyalar | Organizations/Index.js, TrialLicenses/Index.js, TrialLicenses/Detail.js |
Beklenen: Aksiyon sonrası yeşil toast. Web tarafı abp.notify → abp-toast.js (duruyor).
Gerçek: @abp/toastr nightly’de yok. Yarn sonrası wwwroot/libs/toastr yok. Admin hâlâ toastr.success(...) çağırıyor. Konsol: toastr is not defined. Mail/activate gidebilir; bildirim kırılır.
UI tekrar (admin, F12 Console açık):
- Admin’e yetkili user ile gir.
- En kolay — Organizations (mail atmadan da görünür):
Console’atypeof toastryaz.undefinedise paket yok.
Sonra: menü Licensing → Organizations → satır Actions → Send Welcome Email → confirm Yes.
Beklenen: yeşil toast. Gerçek:Uncaught ReferenceError: toastr is not defined. - Trial Licenses: menü Licensing → Trial Licenses.
- Actions → Send Welcome Email (confirm) → aynı hata.
- Status’ü activate edilebilir bir kayıtta Actions → Activate (confirm) → aynı hata;
dataTable.ajax.reload()de.theniçinde kaldığı için tablo yenilenmeyebilir. - Satıra girip Activate butonu →
Detail.jsaynıtoastr.success.
- Permission yoksa aksiyon menüde görünmez:
AbpIoAdmin.Organizations.Manage.SendWelcomeEmail/AbpIoAdmin.TrialLicenses.Manage.Update.
Www: abp.notify.* kullanıyor; bu hata yok. owl/timeago/jquery-form web UI’da bu nightly ile kırılmıyor.
Test: Admin wwwroot/libs/toastr olmamalı. Console typeof toastr === "undefined". Send Welcome Email tıkla → toastr is not defined.
Doğrulama
Select-String -Path "websites/abp.io/Directory.Packages.props" -Pattern "BlobStoring.Azure|preview202608|
"
dotnet build "websites/abp.io/src/Volo.AbpIo.Telemetry.Simulator" 2>&1 | Select-String "MSB3245"
Test-Path "websites/abp.io/src/Volo.AbpIo.Admin.Web/wwwroot/libs/toastr"|
-> Findings h4, h5, and h6 are related to the vs-internal repository and are therefore not related to PR; relevant improvements will be made in the vs-internal repository. |
Extend
switch-to-nightlywith--includeand--exclude-packagesoptions to optionally update Central Package Management files (likeDirectory.Packages.props) alongside regular project/package updates. The updater now resolves the nightly ABP version once, updatesPackageVersion Include="Volo.*"entries with exclusion and LeptonX/Studio safeguards, and logs/continues on MyGet or file-write failures. Also fixes.npmrcregistry appending to insert a newline before the added registry entry.Test Scenario: abp switch-to-nightly --include / --exclude-packages
Prerequisites
abp switch-to-nightly -d
Test Scenario: abp switch-to-nightly --include / --exclude-packages
Prerequisites
abp switch-to-nightly -d
abp switch-to-nightly -d --include Directory.Packages.props --exclude-packages
Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX,Volo.Abp.Studio.Client.
abp switch-to-nightly -d --include DoesNotExist.props
Run step 2's command twice in a row.
Run against a solution where multiple .csproj files reference thps.
(Task.WaitAll) per-project update has fully completed, so no cthe shared file.
Simulate a network failure to MyGet (e.g. temporarily block www.abp.io).