dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.89k stars 783 forks source link

FSharp.DependencyManager.Nuget ignoring sources #16071

Closed kevmal closed 6 months ago

kevmal commented 1 year ago

If a nuget source has name with a space in it then it's skipped. Looks like the regex assumes no spaces: https://github.com/dotnet/fsharp/blob/1492e70e6d99931ce5133819ebaf4caaadf8da54/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs#L312-L342

pimbrouwers commented 9 months ago

Thank you for this Kevin. In my case it was affecting interactive, see: https://github.com/dotnet/interactive/issues/3289

onionhammer commented 7 months ago

Just to reiterate: This issue appears to be the root cause of this issue

https://github.com/dotnet/interactive/issues/3289

Likely broken in this PR: https://github.com/dotnet/fsharp/pull/14769

@KevinRansom

onionhammer commented 6 months ago

Seems not to like package sources with spaces in the name

KevinRansom commented 6 months ago

Okay, I understand now.

The issue occurs when the sources are specified in a Nuget.config file alongside the script.

For example: A script that says:

#r "nuget:FSharp.Compiler.Service, 43.8.300-dev"

Alongside a Nuget.config file containing:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!-- Only specify feed for Arcade SDK (see https://github.com/Microsoft/msbuild/issues/2982) -->
  <packageSources>
    <clear />
    <add key="MySourceDirectory" value="C:\\temp\\repro\\my source  directory" />
  </packageSources>
</configuration>

Will not find files the nuget package in: "C:\temp\repro\my source directory".

This is certainly a bug, and I will fix it. In the mean time this is equivalent and will work. Update the script to include the source using the #i directive

#i "nuget:C:\\temp\\repro\\my source  directory"
#r "nuget:FSharp.Compiler.Service, 43.8.300-dev"
onionhammer commented 6 months ago

I was seeing it with global nuget config also, and when the "key" had a space, not the directory