Search code examples
c#.netvisual-studio-codenugetnuget-package

error: NU1100: Unable to resolve 'MicrosoftOfficeCore (>= 15.0.0)' for 'net5.0'


In Terminal of Visual Studio Code, when I try to run:

dotnet add package MicrosoftOfficeCore --version 15.0.0

I get the following error on Visual Studio Code terminal:

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

Do anyone have an idea?


Solution

    1. Try clearing the NuGet cache using dotnet nuget locals all --clear, and then try to add your package.

    2. If that doesn't work, try deleting the NuGet.config file present inside C:\Users\<username>\AppData\Roaming\NuGet directory, and then restore it using dotnet restore command. Try adding your package after this.

    The above solution works irrespective of whichever .NET version you're using.