Skip to content

FSharp.DependencyManager.Nuget ignoring sources #16071

@kevmal

Description

@kevmal

If a nuget source has name with a space in it then it's skipped. Looks like the regex assumes no spaces:

if success then
// String returned by `dotnet nuget list source --format detailed` is formatted similar to:
// Registered Sources:
// 1. dotnet-eng [Enabled]
// https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json
// 2. dotnet-tools [Enabled]
// https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json
// 3. dotnet5 [Enabled]
// https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json
// Use enabled feeds only (see NuGet.Commands.ListSourceRunner.Run) and strip off the flags.
let pattern =
@"(\s*\d+\.+\s*)(?'name'\S*)(\s*)\[(?'enabled'Enabled|Disabled)\](\s*)$(\s*)(?'uri'\S*)"
let regex =
new Regex(pattern, RegexOptions.Multiline ||| RegexOptions.ExplicitCapture)
let sourcelist = String.concat Environment.NewLine stdOut
String.concat
Environment.NewLine
[|
for m in regex.Matches(sourcelist) do
let name = m.Groups["name"].Value
let enabled = m.Groups["enabled"].Value
let uri = m.Groups["uri"].Value
if enabled.Length > 0 && enabled[0] = 'E' then
$""" <add key="{name}" value="{uri}" />"""
|]
else
""

Metadata

Metadata

Assignees

Labels

Area-FSIBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions