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 ,
I was able to resolve this issue by adding few more package source links in nuget package source(Tools -> Nuget Package Manager -> Package Manager settings -> Package source).
Before trying above solution, I tried, clearing nuget cache, updating targetFramework, re-installing the package, updating the package manager, none of them worked.
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 :
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
I resolved this by adding dependent file
<files>
<file src="bin\$configuration$\netstandard2.0\a.dll" target="lib\netstandard2.0" />
<file src="bin\$configuration$\net45\a.dll" target="lib\net45" />
<file src="bin\$configuration$\netstandard2.0\b.dll" target="lib\netstandard2.0" />
<file src="bin\$configuration$\net45\b.dll" target="lib\net45" />
</files>
Also, don't forget to clean local cache nuget locals all –clean
or change version.
I just did this and it went fine. In your Visual Studio, go to:
for me: %appdata%\NuGet\NuGet.Config contained only
<activePackageSource>
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</activePackageSource>
after doing
nuget sources add -Name "NuGet official package source" -Source "https://api.nuget.org/v3/index.json"
this was added
<packageSources> <add key="https://www.nuget.org/api/v2/" value="https://www.nuget.org/api/v2/" /> <add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" /> </packageSources>
afterwards packeges were found.