how to resolve “Unable to find package” nuget error

后端 未结 5 989
囚心锁ツ
囚心锁ツ 2021-01-05 02:21

Working on creating a nuget pkg for a project (A.csproj) which depends on another project (B.csprojec) added as a project reference.
Here is the .nuspec ,



        
5条回答
  •  长情又很酷
    2021-01-05 02:50

    The package source was offline !!

    I installed VS2017 professional on my system and opened an existing project and found that multiple packages were missing. I tried everything I could, without looking at Package Source !!

    I am writing this answer as I tried the below solutions but none of them worked :

    1. Clearing the cache
    2. Restoring or re-installing the packages
    3. Changing the targetFramework
    4. Updating the Nuget Package manager

    Solution:

    Step 01. Go to Package Manager Settings (Tools > Nuget Package Manager > Package Manager Settings)

    Step 02. Check the Package Source(s). As you can see, the package source is here already downloaded SDK/nugets/packages. I don't know the reason but the online package source from nuget.org was missing from my system installation of Visual Studio.

    Step 03. Install the nuget.org as package source and then 'Clear All Nuget Cache(s)' and then restore the packages. The error will go away.

    Name: nuget.org ( or as you wish) Source: https://api.nuget.org/v3/index.json

提交回复
热议问题