Answer a question

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?

Answers

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

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
      <clear /> <!-- (optional) this is for clear sources like default Offline repo -->
      <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>
Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐