Skip to content

Preserve existing package source mappings in XSAddNugetSource.prgx#1945

Closed
Copilot wants to merge 1 commit into
mainfrom
copilot/1915-adjust-package-source-mappings
Closed

Preserve existing package source mappings in XSAddNugetSource.prgx#1945
Copilot wants to merge 1 commit into
mainfrom
copilot/1915-adjust-package-source-mappings

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 22, 2026

The script was unconditionally adding/overwriting packageSourceMapping entries on every run, causing pre-existing third-party source mappings to be lost.

Changes

Main body — conditional mapping logic

  • If packageSourceMapping section already exists: only update/add the XSharp.*XSharp Offline Packages entry; all other mappings are left untouched
  • If no packageSourceMapping section exists: create it fresh with both *nuget.org and XSharp.*XSharp Offline Packages (adding nuget.org as a package source too if absent)

GetSetSourceMapping — true update semantics

  • Previously skipped entirely if the source key was already mapped, even if the required pattern was missing
  • Now locates the existing <packageSource> element and adds the pattern if absent — making the function a genuine "update or add"
<!-- Before (existing mapping silently dropped if source key was present) -->
<packageSourceMapping>
  <packageSource key="XSharp Offline Packages" />  <!-- no pattern added -->
</packageSourceMapping>

<!-- After -->
<packageSourceMapping>
  <packageSource key="XSharp Offline Packages">
    <package pattern="XSharp.*" />   <!-- ensured present -->
  </packageSource>
  <!-- all other pre-existing entries preserved -->
</packageSourceMapping>

Agent-Logs-Url: https://github.com/X-Sharp/XSharpPublic/sessions/8428819e-b1b2-4ad3-8c64-2c054715861d

Co-authored-by: RobertvanderHulst <14240939+RobertvanderHulst@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants