Visual Studio 2019 F# NU1101 无法找到包 FSharp.core

2024-06-19

我刚刚开始使用 Microsoft Visual Studio 和 F#。

我已尽可能地遵循他们的教程,但是当我尝试运行代码时,他们告诉我收到错误:

NU1101: Unable to find package FSharp.Core. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages

我在文件中的整个代码如下所示:

module HelloSquare

let square x = x * x

[<EntryPoint>]
let main argv =
    printfn "%d squared is: %d!" 12 (square 12)
    0 // Return an integer exit code

我怎样才能解决这个问题?任何帮助将不胜感激,如果有助于解决问题,我绝对愿意提供更多信息。

编辑: 它是一个 .NET 核心项目

这是我正在遵循的教程:https://learn.microsoft.com/en-us/dotnet/fsharp/get-started/get-started-visual-studio https://learn.microsoft.com/en-us/dotnet/fsharp/get-started/get-started-visual-studio

这是我遵循的安装教程,我做了 Visual Studio 部分,而不是 Visual Studio 代码、Mac 或服务器部分:https://learn.microsoft.com/en-us/dotnet/fsharp/get-started/install-fsharp#install-f-with-visual-studio https://learn.microsoft.com/en-us/dotnet/fsharp/get-started/install-fsharp#install-f-with-visual-studio

我如何切换到在线 nuget 源?


检查您是否至少配置了一个 nuget 源,使用:

dotnet nuget list source

它应该返回类似:

Registered Sources:
  1.  nuget.org [Enabled]
      https://api.nuget.org/v3/index.json

如果您没有配置任何源,则使用dotnet nuget 添加源 https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-add-source添加一个。

e.g.:

dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org

我认为这可能是当前版本的 dotnet core (5.0.6) 的问题

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Visual Studio 2019 F# NU1101 无法找到包 FSharp.core 的相关文章

随机推荐