-
Notifications
You must be signed in to change notification settings - Fork 790
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
dotnet fsi fail to load nuget package in dotnet SDK 7.0.302 #15294
Comments
I cannot reproduce it. It seems it doesn't see your nuget.config, or it's overridden locally. @vlza ➜ test-global-json cat .\global.json
{
"sdk": {
"version": "7.0.302"
}
}
@vlza ➜ test-global-json dotnet --version
7.0.302
@vlza ➜ test-global-json dotnet fsi --nologo
> #r "nuget:NBomber";;
[Loading C:\Users\vlza\.packagemanagement\nuget\Projects\109832--268686bf-5006-4736-adb8-f45c6464592f\Project.fsproj.fsx]
module FSI_0002.Project.fsproj
>
@vlza ➜ test-global-json |
This is suspicious |
I fully expect that is an issue, however, this is where that path is created:
It seems as if there are circumstances where path.Combine assumes the ".packagemanagement" is an extension. So that is going to mess up the caching, but wouldn't fail the resolution. @albertwoo
has become corrupted: The contents of the file should include a link to the global nuget source:
|
@KevinRansom the NuGet.Config should not be corrupted. The first time I found this issue, is when I help a college to set her fresh Mac for dotnet. Then I tried on my owen Mac with the 7.0.302 SDK, and reproduced this issue. When I create a globaljson to pin the version to 7.0.203, the build script worked as normal. I also tried to switch back to 7.0.302 again, and found the issue happens again. That is why I report this issue. But today, on my Windows PC, I can not reproduce this issue anymore. And also tried on WSL with Ubuntu 20. I can also not able to reproduce. Maybe it is related to nuget.org which cannot find the package without a specific version. And now it works. Sorry to bother, I will close this issue for now. |
I'm having the same problem, after updating Visual Studio on my two Windows 11, I got the latest version of NET
Once I use The error content is the same as @albertwoo
I don't have this problem with Ubuntu, macOS, but I have this problem with both of my Windows 11 operating systems. |
Apparently the nuget.org source is not inserted correctly,I don't have this problem when I switch back to any version as long as I don't use version 7.0.302 |
Then I will reopen it. 😂 |
I briefly analyzed it and guessed that it was a problem introduced by Commit FSharp.DependencyManager.fs#L401 The code means that a new Written from FSharp.DependencyManager.ProjectFile.fs#L19
Then,Replace "$(nuget_sources)" in the file (FSharp.DependencyManager.fs#L393)[https://github.com/dotnet/fsharp/blob/main/src/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.fs#L393]
And ,
And look at the results of my command prompt:
So I summarize as follows: The regular expression to match is "Enabled" in English, while mine is "已启用" in Chinese,So it fails and returns the empty string, which is why the source of Nuget.config in the project directory is empty @vzarytovskii @albertwoo |
@0xBruceLiao thanks for the great analysis, @KevinRansom as we thought yesterday, culture is the problem when we collecting sources. |
@0xBruceLiao , nice wrk on figuring out what the issue is: Localizing the Enabled seems like a poor choice for a feature that was intended to be machine read. could you run this command and provide the output please: dotnet nuget list source --format short
|
Okay, I had to go to detailed so that we could get the name of the source associated with a uri. This is necessary to allow nuget.config authenticated sources to work which are keyed by name. Miserable the Enabled/Disabled state is authenticated. Okay: from the nuget sources it seems that --format short is not localized, so I will run both short and detailed and union them. |
Luckily there is a much easier way of doing this: The Sdk supports an environment variable
|
Both fixes are merged: |
dotnet fsi fail to load nuget pacakge in donet SDK 7.0.302, I also tried the dotnet 8 preview 4, and the error is the same. It worked in 7.0.203 and older versions.
Repro steps
Make sure you are using 7.0.302: dotent --version
Run: dotnet fsi
Run: #r "nuget:NBomber";;
Or try other nuget packages, like Fun.Build
You will get below error:
Expected behavior
Should work as before
Actual behavior
Throw error
Known workarounds
Sometimes, if you attach specific version it may work, but not always. And if you are using dotnet fsi xxx.fsx and the nuget package is used in the fsx file, then most of the chance it will not work.
Related information
Provide any related information (optional):
The text was updated successfully, but these errors were encountered: