question

ArvindRajV-0207 avatar image
0 Votes"
ArvindRajV-0207 asked PerryQian-MSFT answered

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

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://docs.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.

vs-setupvs-extensionsdotnet-package-management
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

TianyuSun-MSFT avatar image
0 Votes"
TianyuSun-MSFT answered

Hi @ArvindRajV-0207 ,

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.



test1.png (23.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

PerryQian-MSFT avatar image
1 Vote"
PerryQian-MSFT answered

Hi @ArvindRajV-0207,

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.





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.