From 1da96c200ff199177ecbc057916db79865c3ed57 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 6 Feb 2026 00:50:43 +0000
Subject: [PATCH 1/5] Initial plan
From 27f89d3f04aa062ace7fc06cd50a76b66cc5d571 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 6 Feb 2026 01:08:58 +0000
Subject: [PATCH 2/5] Add validation to reject --add-source with package source
mapping
- Add ValidateSourceMappingCompatibility method to check for incompatible option combination
- Add CannotUseAddSourceWithSourceMapping error message
- Add test RejectsAdditionalSourceFeedsWhenMappingActive
Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
---
src/Cli/dotnet/CliStrings.resx | 3 +++
.../NuGetPackageDownloader.cs | 25 +++++++++++++++++++
src/Cli/dotnet/xlf/CliStrings.cs.xlf | 5 ++++
src/Cli/dotnet/xlf/CliStrings.de.xlf | 5 ++++
src/Cli/dotnet/xlf/CliStrings.es.xlf | 5 ++++
src/Cli/dotnet/xlf/CliStrings.fr.xlf | 5 ++++
src/Cli/dotnet/xlf/CliStrings.it.xlf | 5 ++++
src/Cli/dotnet/xlf/CliStrings.ja.xlf | 5 ++++
src/Cli/dotnet/xlf/CliStrings.ko.xlf | 5 ++++
src/Cli/dotnet/xlf/CliStrings.pl.xlf | 5 ++++
src/Cli/dotnet/xlf/CliStrings.pt-BR.xlf | 5 ++++
src/Cli/dotnet/xlf/CliStrings.ru.xlf | 5 ++++
src/Cli/dotnet/xlf/CliStrings.tr.xlf | 5 ++++
src/Cli/dotnet/xlf/CliStrings.zh-Hans.xlf | 5 ++++
src/Cli/dotnet/xlf/CliStrings.zh-Hant.xlf | 5 ++++
.../NuGetPackageInstallerTests.cs | 20 +++++++++++++++
16 files changed, 113 insertions(+)
diff --git a/src/Cli/dotnet/CliStrings.resx b/src/Cli/dotnet/CliStrings.resx
index e84f13ad8021..65cf8884f3ad 100644
--- a/src/Cli/dotnet/CliStrings.resx
+++ b/src/Cli/dotnet/CliStrings.resx
@@ -455,6 +455,9 @@ setx PATH "%PATH%;{0}"
{0}: failed to find toolAssembly for {1}
+
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+
Failed to load NuGet source {0}
diff --git a/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs b/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs
index a0ce16fe6d0b..cdba7ea6f87e 100644
--- a/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs
+++ b/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs
@@ -371,6 +371,25 @@ private IEnumerable LoadOverrideSources(PackageSourceLocation pac
}
+ private void ValidateSourceMappingCompatibility(PackageSourceLocation sourceLocation, PackageSourceMapping mapping)
+ {
+ // When mapping feature is active and user specified extra feeds via CLI, this creates a conflict
+ // because the extra feeds won't be in the mapping configuration
+ if (mapping?.IsEnabled != true)
+ {
+ return;
+ }
+
+ var extraFeeds = sourceLocation?.AdditionalSourceFeed;
+ if (extraFeeds == null || extraFeeds.Length == 0)
+ {
+ return;
+ }
+
+ // Found both mapping and CLI-added feeds - this combination won't work
+ throw new NuGetPackageInstallerException(CliStrings.CannotUseAddSourceWithSourceMapping);
+ }
+
private List LoadDefaultSources(PackageId packageId, PackageSourceLocation packageSourceLocation = null, PackageSourceMapping packageSourceMapping = null)
{
List defaultSources = [];
@@ -395,6 +414,12 @@ private List LoadDefaultSources(PackageId packageId, PackageSourc
packageSourceMapping ??= PackageSourceMapping.GetPackageSourceMapping(settings);
+ // Ensure compatibility between source mapping configuration and CLI options
+ if (_shouldUsePackageSourceMapping)
+ {
+ ValidateSourceMappingCompatibility(packageSourceLocation, packageSourceMapping);
+ }
+
// filter package patterns if enabled
if (_shouldUsePackageSourceMapping && packageSourceMapping?.IsEnabled == true)
{
diff --git a/src/Cli/dotnet/xlf/CliStrings.cs.xlf b/src/Cli/dotnet/xlf/CliStrings.cs.xlf
index 389c5822431c..b8c635f20f56 100644
--- a/src/Cli/dotnet/xlf/CliStrings.cs.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.cs.xlf
@@ -59,6 +59,11 @@
Zadání možností -r|--runtime a -os zároveň se nepodporuje.
+
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+
+ Column maximum width must be greater than zero.Maximální šířka sloupce musí být větší než nula.
diff --git a/src/Cli/dotnet/xlf/CliStrings.de.xlf b/src/Cli/dotnet/xlf/CliStrings.de.xlf
index b1249c1c91e0..526be4f2358b 100644
--- a/src/Cli/dotnet/xlf/CliStrings.de.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.de.xlf
@@ -59,6 +59,11 @@
Das gleichzeitige Angeben der Optionen „-r|--runtime“ und „-os“ wird nicht unterstützt.
+
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+
+ Column maximum width must be greater than zero.Die maximale Spaltenbreite muss größer als 0 sein.
diff --git a/src/Cli/dotnet/xlf/CliStrings.es.xlf b/src/Cli/dotnet/xlf/CliStrings.es.xlf
index c2a7f96f8839..b53adb419c5a 100644
--- a/src/Cli/dotnet/xlf/CliStrings.es.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.es.xlf
@@ -59,6 +59,11 @@
No se admite la especificación de las opciones '-r|--runtime' y '-os'.
+
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+
+ Column maximum width must be greater than zero.El ancho máximo de la columna debe ser superior a cero.
diff --git a/src/Cli/dotnet/xlf/CliStrings.fr.xlf b/src/Cli/dotnet/xlf/CliStrings.fr.xlf
index eeff65e8e1e0..8a6ecc195f3a 100644
--- a/src/Cli/dotnet/xlf/CliStrings.fr.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.fr.xlf
@@ -59,6 +59,11 @@
La spécification des options « -r |--Runtime » et « os » n’est pas prise en charge.
+
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+
+ Column maximum width must be greater than zero.La largeur maximale de colonne doit être supérieure à zéro.
diff --git a/src/Cli/dotnet/xlf/CliStrings.it.xlf b/src/Cli/dotnet/xlf/CliStrings.it.xlf
index 206d295fe385..9f9a84940bc8 100644
--- a/src/Cli/dotnet/xlf/CliStrings.it.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.it.xlf
@@ -59,6 +59,11 @@
La specifica di entrambe le opzioni `-r|--runtime` e `-os` non è supportata.
+
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+
+ Column maximum width must be greater than zero.La larghezza massima della colonna deve essere maggiore di zero.
diff --git a/src/Cli/dotnet/xlf/CliStrings.ja.xlf b/src/Cli/dotnet/xlf/CliStrings.ja.xlf
index 4a8b5dd083ad..395160dad564 100644
--- a/src/Cli/dotnet/xlf/CliStrings.ja.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.ja.xlf
@@ -59,6 +59,11 @@
`-r|--runtime` および `-os` オプションの両方を指定することはサポートされていません。
+
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+
+ Column maximum width must be greater than zero.列の最大幅はゼロより大きくなければなりません。
diff --git a/src/Cli/dotnet/xlf/CliStrings.ko.xlf b/src/Cli/dotnet/xlf/CliStrings.ko.xlf
index 069408145055..81b2687cc8b0 100644
--- a/src/Cli/dotnet/xlf/CliStrings.ko.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.ko.xlf
@@ -59,6 +59,11 @@
`-r|--runtime` 및 `-os` 옵션을 모두 지정하는 것은 지원되지 않습니다.
+
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+
+ Column maximum width must be greater than zero.열 최대 너비는 0보다 커야 합니다.
diff --git a/src/Cli/dotnet/xlf/CliStrings.pl.xlf b/src/Cli/dotnet/xlf/CliStrings.pl.xlf
index 09cf70e51f97..d1e805c29fdc 100644
--- a/src/Cli/dotnet/xlf/CliStrings.pl.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.pl.xlf
@@ -59,6 +59,11 @@
Określanie opcji „-r|--runtime” i „-os” nie jest obsługiwane.
+
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+
+ Column maximum width must be greater than zero.Maksymalna szerokość kolumny musi być większa niż zero.
diff --git a/src/Cli/dotnet/xlf/CliStrings.pt-BR.xlf b/src/Cli/dotnet/xlf/CliStrings.pt-BR.xlf
index f92a5e258743..24daa58356ed 100644
--- a/src/Cli/dotnet/xlf/CliStrings.pt-BR.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.pt-BR.xlf
@@ -59,6 +59,11 @@
Não há suporte para especificar as opções '-r |--runtime ' e '-a |--os '.
+
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+
+ Column maximum width must be greater than zero.A largura máxima da coluna deve ser maior que zero.
diff --git a/src/Cli/dotnet/xlf/CliStrings.ru.xlf b/src/Cli/dotnet/xlf/CliStrings.ru.xlf
index a45ec9415519..7ab8b2c946c6 100644
--- a/src/Cli/dotnet/xlf/CliStrings.ru.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.ru.xlf
@@ -59,6 +59,11 @@
Указание параметров "-r|--runtime" и "-os" не поддерживается.
+
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+
+ Column maximum width must be greater than zero.Максимальная ширина столбца должна быть больше нуля.
diff --git a/src/Cli/dotnet/xlf/CliStrings.tr.xlf b/src/Cli/dotnet/xlf/CliStrings.tr.xlf
index b139a21005e6..2a88dad9a84a 100644
--- a/src/Cli/dotnet/xlf/CliStrings.tr.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.tr.xlf
@@ -59,6 +59,11 @@
Hem `-r|--runtime` hem de `-os` seçeneğinin belirtilmesi desteklenmiyor.
+
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+
+ Column maximum width must be greater than zero.Maksimum sütun genişliği sıfırdan büyük olmalıdır.
diff --git a/src/Cli/dotnet/xlf/CliStrings.zh-Hans.xlf b/src/Cli/dotnet/xlf/CliStrings.zh-Hans.xlf
index 28f1e78422ac..23622ae70d00 100644
--- a/src/Cli/dotnet/xlf/CliStrings.zh-Hans.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.zh-Hans.xlf
@@ -59,6 +59,11 @@
不支持同时指定“-r |--runtime”和“-os”选项。
+
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+
+ Column maximum width must be greater than zero.列的最大宽度必须大于零。
diff --git a/src/Cli/dotnet/xlf/CliStrings.zh-Hant.xlf b/src/Cli/dotnet/xlf/CliStrings.zh-Hant.xlf
index 59521667921e..ab7e59678b5a 100644
--- a/src/Cli/dotnet/xlf/CliStrings.zh-Hant.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.zh-Hant.xlf
@@ -59,6 +59,11 @@
不支援同時指定 `-r|--runtime` 與 `-os` 選項。
+
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+
+ Column maximum width must be greater than zero.資料行寬度上限必須大於零。
diff --git a/test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageInstallerTests.cs b/test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageInstallerTests.cs
index 8e0693efdad9..cbed99704b05 100644
--- a/test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageInstallerTests.cs
+++ b/test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageInstallerTests.cs
@@ -391,5 +391,25 @@ private static FilePath GenerateRandomNugetConfigFilePath()
private static string GetTestLocalFeedPath() =>
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestAssetLocalNugetFeed");
+
+ [Fact]
+ public async Task RejectsAdditionalSourceFeedsWhenMappingActive()
+ {
+ var mappingRules = new Dictionary>
+ {
+ { "feed1", new List { "PackageX.*" } }
+ };
+ var mapping = new PackageSourceMapping(new ReadOnlyDictionary>(mappingRules));
+ string someFeed = GetTestLocalFeedPath();
+
+ var download = async () => await _toolInstaller.DownloadPackageAsync(
+ TestPackageId,
+ new NuGetVersion(TestPackageVersion),
+ new PackageSourceLocation(additionalSourceFeeds: new[] { someFeed }),
+ packageSourceMapping: mapping);
+
+ var ex = await download.Should().ThrowAsync();
+ ex.Which.Message.Should().Contain(CliStrings.CannotUseAddSourceWithSourceMapping);
+ }
}
}
From ed3346f048c774bb5c0aa91977042f4e2becdff7 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 6 Feb 2026 01:16:30 +0000
Subject: [PATCH 3/5] Fix package source mapping tests to use nuget config
instead of source overrides
Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
---
.../NuGetPackageInstallerTests.cs | 68 ++++++++++++-------
1 file changed, 42 insertions(+), 26 deletions(-)
diff --git a/test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageInstallerTests.cs b/test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageInstallerTests.cs
index cbed99704b05..5c64eacaee25 100644
--- a/test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageInstallerTests.cs
+++ b/test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageInstallerTests.cs
@@ -174,43 +174,59 @@ public async Task GivenARelativeSourcePathInstallSucceeds()
[Fact]
public async Task GivenNoPackageSourceMappingItShouldError()
{
- string getTestLocalFeedPath = GetTestLocalFeedPath();
- string relativePath = Path.GetRelativePath(Environment.CurrentDirectory, getTestLocalFeedPath);
- Log.WriteLine(relativePath);
- var dictionary = new Dictionary>
- {
- { "sourceA", new List() { "a" } }
- };
- var patterns = new ReadOnlyDictionary>(dictionary);
- var mockPackageSourceMapping = new PackageSourceMapping(patterns);
+ string testFeed = GetTestLocalFeedPath();
+ FilePath configPath = GenerateRandomNugetConfigFilePath();
+ FileSystemWrapper fs = new();
+
+ fs.Directory.CreateDirectory(configPath.GetDirectoryPath().Value);
+ string configContent = $@"
+
+
+
+
+
+
+
+
+
+
+";
+ fs.File.WriteAllText(configPath.Value, configContent);
- Func a = () => _toolInstaller.DownloadPackageAsync(
+ Func downloadAction = () => _toolInstaller.DownloadPackageAsync(
TestPackageId,
new NuGetVersion(TestPackageVersion),
- new PackageSourceLocation(additionalSourceFeeds: [ relativePath ]),
- packageSourceMapping: mockPackageSourceMapping);
- (await a.Should().ThrowAsync()).And.Message.Should().Contain(string.Format(CliStrings.FailedToFindSourceUnderPackageSourceMapping, TestPackageId));
+ new PackageSourceLocation(nugetConfig: configPath));
+ (await downloadAction.Should().ThrowAsync()).And.Message.Should().Contain(string.Format(CliStrings.FailedToFindSourceUnderPackageSourceMapping, TestPackageId));
}
[Fact]
public async Task GivenPackageSourceMappingFeedNotFoundItShouldError()
{
- string getTestLocalFeedPath = GetTestLocalFeedPath();
- string relativePath = Path.GetRelativePath(Environment.CurrentDirectory, getTestLocalFeedPath);
- Log.WriteLine(relativePath);
- var dictionary = new Dictionary>
- {
- { "nonexistentfeed", new List() { TestPackageId.ToString() } }
- };
- var patterns = new ReadOnlyDictionary>(dictionary);
- var mockPackageSourceMapping = new PackageSourceMapping(patterns);
+ string testFeed = GetTestLocalFeedPath();
+ FilePath configPath = GenerateRandomNugetConfigFilePath();
+ FileSystemWrapper fs = new();
+
+ fs.Directory.CreateDirectory(configPath.GetDirectoryPath().Value);
+ string configContent = $@"
+
+
+
+
+
+
+
+
+
+
+";
+ fs.File.WriteAllText(configPath.Value, configContent);
- Func a = () => _toolInstaller.DownloadPackageAsync(
+ Func downloadAction = () => _toolInstaller.DownloadPackageAsync(
TestPackageId,
new NuGetVersion(TestPackageVersion),
- new PackageSourceLocation(additionalSourceFeeds: [ relativePath ]),
- packageSourceMapping: mockPackageSourceMapping);
- (await a.Should().ThrowAsync()).And.Message.Should().Contain(string.Format(CliStrings.FailedToMapSourceUnderPackageSourceMapping, TestPackageId));
+ new PackageSourceLocation(nugetConfig: configPath));
+ (await downloadAction.Should().ThrowAsync()).And.Message.Should().Contain(string.Format(CliStrings.FailedToMapSourceUnderPackageSourceMapping, TestPackageId));
}
[Fact]
From c35433bfffe43ecbb6444cc907b062963120d5c2 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 6 Feb 2026 01:18:59 +0000
Subject: [PATCH 4/5] Address code review feedback on test
Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
---
.../NuGetPackageInstallerTests.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageInstallerTests.cs b/test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageInstallerTests.cs
index 5c64eacaee25..a23dac5004c2 100644
--- a/test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageInstallerTests.cs
+++ b/test/Microsoft.DotNet.PackageInstall.Tests/NuGetPackageInstallerTests.cs
@@ -418,14 +418,14 @@ public async Task RejectsAdditionalSourceFeedsWhenMappingActive()
var mapping = new PackageSourceMapping(new ReadOnlyDictionary>(mappingRules));
string someFeed = GetTestLocalFeedPath();
- var download = async () => await _toolInstaller.DownloadPackageAsync(
+ var download = () => _toolInstaller.DownloadPackageAsync(
TestPackageId,
new NuGetVersion(TestPackageVersion),
new PackageSourceLocation(additionalSourceFeeds: new[] { someFeed }),
packageSourceMapping: mapping);
- var ex = await download.Should().ThrowAsync();
- ex.Which.Message.Should().Contain(CliStrings.CannotUseAddSourceWithSourceMapping);
+ (await download.Should().ThrowAsync())
+ .Which.Message.Should().Contain(CliStrings.CannotUseAddSourceWithSourceMapping);
}
}
}
From 43fdca5605c314e1ea5c2efdc9497d3aefbde845 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 6 Feb 2026 23:13:52 +0000
Subject: [PATCH 5/5] Simplify error message per feedback
Remove redundant second sentence and change "different" to "additional"
Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
---
src/Cli/dotnet/CliStrings.resx | 2 +-
src/Cli/dotnet/xlf/CliStrings.cs.xlf | 4 ++--
src/Cli/dotnet/xlf/CliStrings.de.xlf | 4 ++--
src/Cli/dotnet/xlf/CliStrings.es.xlf | 4 ++--
src/Cli/dotnet/xlf/CliStrings.fr.xlf | 4 ++--
src/Cli/dotnet/xlf/CliStrings.it.xlf | 4 ++--
src/Cli/dotnet/xlf/CliStrings.ja.xlf | 4 ++--
src/Cli/dotnet/xlf/CliStrings.ko.xlf | 4 ++--
src/Cli/dotnet/xlf/CliStrings.pl.xlf | 4 ++--
src/Cli/dotnet/xlf/CliStrings.pt-BR.xlf | 4 ++--
src/Cli/dotnet/xlf/CliStrings.ru.xlf | 4 ++--
src/Cli/dotnet/xlf/CliStrings.tr.xlf | 4 ++--
src/Cli/dotnet/xlf/CliStrings.zh-Hans.xlf | 4 ++--
src/Cli/dotnet/xlf/CliStrings.zh-Hant.xlf | 4 ++--
14 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/src/Cli/dotnet/CliStrings.resx b/src/Cli/dotnet/CliStrings.resx
index 65cf8884f3ad..9852b3e8cb5c 100644
--- a/src/Cli/dotnet/CliStrings.resx
+++ b/src/Cli/dotnet/CliStrings.resx
@@ -456,7 +456,7 @@ setx PATH "%PATH%;{0}"
{0}: failed to find toolAssembly for {1}
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mappingFailed to load NuGet source {0}
diff --git a/src/Cli/dotnet/xlf/CliStrings.cs.xlf b/src/Cli/dotnet/xlf/CliStrings.cs.xlf
index b8c635f20f56..db5371f22682 100644
--- a/src/Cli/dotnet/xlf/CliStrings.cs.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.cs.xlf
@@ -60,8 +60,8 @@
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
diff --git a/src/Cli/dotnet/xlf/CliStrings.de.xlf b/src/Cli/dotnet/xlf/CliStrings.de.xlf
index 526be4f2358b..ddea45d9cfb0 100644
--- a/src/Cli/dotnet/xlf/CliStrings.de.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.de.xlf
@@ -60,8 +60,8 @@
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
diff --git a/src/Cli/dotnet/xlf/CliStrings.es.xlf b/src/Cli/dotnet/xlf/CliStrings.es.xlf
index b53adb419c5a..2e66a832a734 100644
--- a/src/Cli/dotnet/xlf/CliStrings.es.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.es.xlf
@@ -60,8 +60,8 @@
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
diff --git a/src/Cli/dotnet/xlf/CliStrings.fr.xlf b/src/Cli/dotnet/xlf/CliStrings.fr.xlf
index 8a6ecc195f3a..b3cd285e60fc 100644
--- a/src/Cli/dotnet/xlf/CliStrings.fr.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.fr.xlf
@@ -60,8 +60,8 @@
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
diff --git a/src/Cli/dotnet/xlf/CliStrings.it.xlf b/src/Cli/dotnet/xlf/CliStrings.it.xlf
index 9f9a84940bc8..6b4798b5e654 100644
--- a/src/Cli/dotnet/xlf/CliStrings.it.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.it.xlf
@@ -60,8 +60,8 @@
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
diff --git a/src/Cli/dotnet/xlf/CliStrings.ja.xlf b/src/Cli/dotnet/xlf/CliStrings.ja.xlf
index 395160dad564..de6ce5eb5e0d 100644
--- a/src/Cli/dotnet/xlf/CliStrings.ja.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.ja.xlf
@@ -60,8 +60,8 @@
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
diff --git a/src/Cli/dotnet/xlf/CliStrings.ko.xlf b/src/Cli/dotnet/xlf/CliStrings.ko.xlf
index 81b2687cc8b0..8e2a8fd5cbe0 100644
--- a/src/Cli/dotnet/xlf/CliStrings.ko.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.ko.xlf
@@ -60,8 +60,8 @@
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
diff --git a/src/Cli/dotnet/xlf/CliStrings.pl.xlf b/src/Cli/dotnet/xlf/CliStrings.pl.xlf
index d1e805c29fdc..ecdf18a4ef35 100644
--- a/src/Cli/dotnet/xlf/CliStrings.pl.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.pl.xlf
@@ -60,8 +60,8 @@
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
diff --git a/src/Cli/dotnet/xlf/CliStrings.pt-BR.xlf b/src/Cli/dotnet/xlf/CliStrings.pt-BR.xlf
index 24daa58356ed..953da0a993eb 100644
--- a/src/Cli/dotnet/xlf/CliStrings.pt-BR.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.pt-BR.xlf
@@ -60,8 +60,8 @@
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
diff --git a/src/Cli/dotnet/xlf/CliStrings.ru.xlf b/src/Cli/dotnet/xlf/CliStrings.ru.xlf
index 7ab8b2c946c6..a0d9c87fb26a 100644
--- a/src/Cli/dotnet/xlf/CliStrings.ru.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.ru.xlf
@@ -60,8 +60,8 @@
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
diff --git a/src/Cli/dotnet/xlf/CliStrings.tr.xlf b/src/Cli/dotnet/xlf/CliStrings.tr.xlf
index 2a88dad9a84a..b69a06287572 100644
--- a/src/Cli/dotnet/xlf/CliStrings.tr.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.tr.xlf
@@ -60,8 +60,8 @@
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
diff --git a/src/Cli/dotnet/xlf/CliStrings.zh-Hans.xlf b/src/Cli/dotnet/xlf/CliStrings.zh-Hans.xlf
index 23622ae70d00..bb50e59dfae7 100644
--- a/src/Cli/dotnet/xlf/CliStrings.zh-Hans.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.zh-Hans.xlf
@@ -60,8 +60,8 @@
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
diff --git a/src/Cli/dotnet/xlf/CliStrings.zh-Hant.xlf b/src/Cli/dotnet/xlf/CliStrings.zh-Hant.xlf
index ab7e59678b5a..f8f638292eac 100644
--- a/src/Cli/dotnet/xlf/CliStrings.zh-Hant.xlf
+++ b/src/Cli/dotnet/xlf/CliStrings.zh-Hant.xlf
@@ -60,8 +60,8 @@
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
- The --add-source option cannot be combined with package source mapping. When source mapping is configured, additional sources specified via command line are not permitted. To use a different source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping
+ The --add-source option cannot be combined with package source mapping. To use an additional source, update your NuGet configuration file's source mapping settings. Learn more: https://aka.ms/nuget-package-source-mapping