From 48281232bf1821790906fcba9e62457d54dd70d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Luthi?= Date: Mon, 27 Mar 2023 11:30:43 +0200 Subject: [PATCH] Use a nuget.config file instead of specifying multiple sources on the command line This works around https://github.com/dotnet/sdk/issues/27202 It also has the benefit of using settings _only_ from the specified config file, ignoring the global nuget.config where package source mapping could interfere with the local source. --- .../Support/TestApp.cs | 9 ++++----- test/TestApp/nuget.config | 11 +++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 test/TestApp/nuget.config diff --git a/test/Serilog.Settings.Configuration.Tests/Support/TestApp.cs b/test/Serilog.Settings.Configuration.Tests/Support/TestApp.cs index ab81df2..a39fe98 100644 --- a/test/Serilog.Settings.Configuration.Tests/Support/TestApp.cs +++ b/test/Serilog.Settings.Configuration.Tests/Support/TestApp.cs @@ -101,14 +101,13 @@ async Task PackAsync() async Task RestoreAsync() { - var packagesDirectory = _workingDirectory.SubDirectory("packages"); + // Can't use "--source . --source https://api.nuget.org/v3/index.json" because of https://github.com/dotnet/sdk/issues/27202 => a nuget.config file is used instead. + // It also has the benefit of using settings _only_ from the specified config file, ignoring the global nuget.config where package source mapping could interfere with the local source. var restoreArgs = new[] { "restore", - "--packages", packagesDirectory.FullName, - "--source", ".", - "--source", "https://api.nuget.org/v3/index.json", + "--configfile", "nuget.config", "-p:Configuration=Release", - $"-p:TargetFramework={TargetFramework}" + $"-p:TargetFramework={TargetFramework}", }; await RunDotnetAsync(_workingDirectory, restoreArgs); } diff --git a/test/TestApp/nuget.config b/test/TestApp/nuget.config new file mode 100644 index 0000000..cfec8fc --- /dev/null +++ b/test/TestApp/nuget.config @@ -0,0 +1,11 @@ + + + + + + + + + + +