Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion eng/update-dependencies/NuGetConfigUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ private static string ToStringWithDeclaration(XDocument doc)
return builder.ToString();
}

/// <summary>
/// Updates the packageSourceCredentials section of the NuGet.config for the current version's package source.
/// Credentials are only needed for internal, non-public-preview builds which use authenticated feeds.
/// Public preview builds use public feeds, so their credentials are removed if present.
/// Only the current version's entry is modified — other versions' credentials are left intact.
/// </summary>
private void UpdatePackageSourceCredentials(DotNetVersion sdkVersion, string pkgSrcName, XElement configuration)
{
XElement? pkgSourceCreds = configuration.Element("packageSourceCredentials");
Expand All @@ -108,7 +114,14 @@ private void UpdatePackageSourceCredentials(DotNetVersion sdkVersion, string pkg
}
else
{
pkgSourceCreds?.Remove();
// Only remove the credentials entry for the current version's package source,
// leaving credentials for other versions intact (e.g. a non-preview version
// may still need authenticated access even if this preview version doesn't).
pkgSourceCreds?.Element(pkgSrcName)?.Remove();
if (pkgSourceCreds is not null && !pkgSourceCreds.HasElements)
{
pkgSourceCreds.Remove();
}
}
}

Expand Down