Unable to work on new existing template Asp.net WebAPI in Core Visual Studio 2019 16.8

Arvind Raj V 1 Reputation point
2020-11-20T03:38:03.337+00:00

Hi,

I have been trying to work on the weather forecast example with swagger in VS 2019 16.8, but when I build the Web API solution after setting up getting error on the NuGet packages for the solution, have tried removing the dependencies for nuget the commenting out code, but results in 404 for the Swagger input opening page.

The project was creating according to the msdn article : https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-5.0&tabs=visual-studio

Normal apps without nuget package are working fine, but solution involving nuget package are not working properly even if package are tried to add from the package manager console (getting the 404 error).

Added nuget.org as source also and then performed the search but not getting any nuget package properly in visual studio 2019 Version 16.8.1.Nuget Error Message

Added screenshot of the issue explained for reference.41266-nuget-reference-not-working-fine.jpg

Any expert advice is highly appreciated.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,327 questions
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
956 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Perry Qian-MSFT 6 Reputation points
    2020-11-30T07:00:37.893+00:00

    Hi @Arvind Raj V ,

    You could also try the following steps to troubleshoot your issue:

    1. close VS, delete the global nuget.config under C:\Users\xxx(current user)\AppData\Roaming\NuGet . Then, clean all nuget caches first or just delete all caches files under C:\Users\xxx(current user)\.nuget\packages.

    2. restart VS IDE and then try again.

    Sincerely,

    Perry


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our * *documentation* to enable e-mail notifications if you want to receive the related email notification for this thread.**

    1 person found this answer helpful.
    0 comments No comments

  2. Tianyu Sun-MSFT 27,031 Reputation points Microsoft Vendor
    2020-11-20T07:30:46.243+00:00

    Hi @Arvind Raj V ,

    Thank you for taking time to post this issue in Microsoft Q&A forum.

    Please check if the package source is set correctly.(Tools > Options > NuGet Package Manager > Package Sources)

    41336-test1.png

    Then go to Tools > Options > NuGet Package Manager > General > Package Restore > select these two options: “Allow NuGet to download missing packages” and “Automatically check for missing packages during build in Visual Studio” > click Clear All NuGet Cache(s) button to clear NuGet cache, and try to install the related NuGet packages in “Manage NuGet Packages” window again.

    You can also try to reinstall these NuGet Packages in Package Manager Console, type Update-Package -reinstall, then check if this issue disappears.

    Besides, please check if the NuGet packages have been installed and saved in this folder: C:\Users\[username]\.nuget\packages.

    If this issue persists, please try to create a new project then test again to check if this issue also appears in newly created project, and this will be useful to narrow down the issue.

    Sincerely,
    Tianyu

    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    0 comments No comments