错误:NU1100:无法为“net5.0”解析“MicrosoftOfficeCore (>= 15.0.0)”

Ghi*_*ere 2 .net c# nuget nuget-package visual-studio-code

在 Visual Studio Code 的终端中,当我尝试运行时:

dotnet add package MicrosoftOfficeCore --version 15.0.0
Run Code Online (Sandbox Code Playgroud)

我在 Visual Studio Code 终端上收到以下错误

error: NU1100: Unable to resolve 'MicrosoftOfficeCore (>= 15.0.0)' for 'net5.0'
error: Package 'MicrosoftOfficeCore' is incompatible with 'all' frameworks in project
Run Code Online (Sandbox Code Playgroud)

你有想法吗 ?

非常感谢。

小智 7

  1. 尝试使用 清除 NuGet 缓存dotnet nuget locals all --clear,然后尝试添加此包。

  2. 如果这不起作用,请尝试删除NuGet.config“C:\Users<username>\AppData\Roaming\NuGet”目录中的文件,然后使用dotnet restore. 尝试在此之后添加包。

  • 工作完美,在我的情况下 `&lt;add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /&gt;` 作为包源丢失安装时创建的默认 nuget.config。 (11认同)
  • 1.同样的错误2.完美运行,非常感谢 (5认同)