Home > database >  Visual Code - error NU1101: Unable to find package Microsoft.EntityFrameworkCore
Visual Code - error NU1101: Unable to find package Microsoft.EntityFrameworkCore

Time:11-28

I am using Visual Studio Code (VS Code) Editor for ASP.NET Core-5 Web API.

I have installed different packages in the VS Code without any error.

However, when I did:

dotnet run

I got this errors:

C:\Users\Kume\source\repos\MyApp\DDM.API.Core\API.Core.csproj : error NU1101: Unable to find package Microsoft.EntityFrameworkCore. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages

C:\Users\Kume\source\repos\MyApp\DDM.API.Core\API.Core.csproj : error NU1101: Unable to find package Microsoft.EntityFrameworkCore.Design. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages

C:\Users\Kume\source\repos\MyApp\DDM.API.Core\API.Core.csproj : error NU1101: Unable to find package Microsoft.EntityFrameworkCore.SqlServer. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages

C:\Users\Kume\source\repos\MyApp\DDM.API.Core\API.Core.csproj : error NU1101: Unable to find package Microsoft.EntityFrameworkCore.Tools. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages

How do I resolve this? Thanks

CodePudding user response:

Your best option is to create a Nuget.config file at the root of your project and place the following content inside:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
      <clear />
      <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>
  • Related