Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C#: Automatically use configured private registry feeds #18850

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
C#: Allow specifying package feeds for dotnet restore as command li…
…ne arguments
  • Loading branch information
mbg committed Feb 24, 2025
commit 5a60a07d60b3fd4bb4c48b73339de83543303b07
Original file line number Diff line number Diff line change
@@ -67,6 +67,16 @@ private string GetRestoreArgs(RestoreSettings restoreSettings)
args += $" --configfile \"{restoreSettings.PathToNugetConfig}\"";
}

// Add package sources. If any are present, they override all sources specified in
// the configuration file(s).
if (restoreSettings.Sources != null)
{
foreach (string source in restoreSettings.Sources)
{
args += $" -s {source}";
}
}

if (restoreSettings.ForceReevaluation)
{
args += " --force";
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ public interface IDotNet
IList<string> GetNugetFeedsFromFolder(string folderPath);
}

public record class RestoreSettings(string File, string PackageDirectory, bool ForceDotnetRefAssemblyFetching, string? PathToNugetConfig = null, bool ForceReevaluation = false, bool TargetWindows = false);
public record class RestoreSettings(string File, string PackageDirectory, bool ForceDotnetRefAssemblyFetching, IList<string>? Sources = null, string? PathToNugetConfig = null, bool ForceReevaluation = false, bool TargetWindows = false);

public partial record class RestoreResult(bool Success, IList<string> Output)
{