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.
Logger.LogInformation("Updating central package \"{PackageId}\" from v{CurrentVersion} to v{LatestVersion}",packageId,versionAttribute.Value,latestVersionFromMyGet);
versionAttribute.Value=latestVersionFromMyGet;
}
}
}
fs.Seek(0,SeekOrigin.Begin);
fs.SetLength(0);
using(varsw=newStreamWriter(fs,DefaultEncoding))
{
awaitsw.WriteAsync(doc.OuterXml);
awaitsw.FlushAsync();
}
}
}
}
catch(Exceptionex)
{
// The file is truncated before the updated XML is written back, so a failure here
// (disk full, process killed, file locked mid-write) can leave it empty/partially
// written on disk. Logged as an error (not a warning) so this isn't missed - the
// rest of the switch-to-nightly run still continues for other solutions/files.
Logger.LogError(ex,"Failed to update central package versions in \"{FilePath}\". The file may now be empty or partially written - please check it manually.",filePath);