nuget local package source is unable to find package - nuget

I'm trying to build some packages for use within my company. I've set up a local folder on my hard drive and added it as a package source before the official nuget source. when I execute nuget list janney, my packages are found however executing install-package janney.myfirstpackage throws an error Install-Package : Unable to find package 'Janney.MyFirstPackage'.
What am I doing wrong? Is this an indication that I've messed up my packages?

In my package manager console my package source was set to nuget rather than all

Related

Download Nuget Package using Nuget.exe

Im working on an automation solution for transfering nuget packages from nuget.org to a private nuget feed. Is it possible to download nuget packages using nuget.exe? If i run the following command, it fails because it tries to install it to the directory, but i dont need to install the package i just need to download it.
.\nuget.exe install Microsoft.AspNetCore.App.Runtime.linux-x64 -source nuget.org -force
This throws the following error:
Error NU5000: Package 'Microsoft.AspNetCore.App.Runtime.linux-x64 7.0.1' has a package type 'DotnetPlatform' that is not supported by project 'C:\foo'.
I am looking for something like a -force option, so that i can just download the package without installing it.

Installing Nuget Gets Dependencies Only

I have a .NET Framework 4.5 project. I'm trying to install Microsoft.NET.Test.Sdk. This should be possible as per https://www.nuget.org/packages/Microsoft.NET.Test.Sdk/
I ran the following command, but get the dependencies only. I tried installing via the Nuget Package Manager too. Finally... I see the package inside my packages.config file, but don't see it in my references. Any suggestions?
Install-Package Microsoft.NET.Test.Sdk -Version 15.7.0
I ended up using Microsoft.VisualStudio.TestTools.UnitTesting.

NuGet restore fails with "Package contains multiple nuspec files" on my machine only

I am using VS2015U3 and NuGet 3.4.4. running on Windows 10 Anniversary Update.
NuGet restore gives this error when run in Visual Studio or when run on the command line.
I've tested this on two independent solution files with the same results. However the build server and my laptop restore packages without any problem.
I've tried downloading NuGet.exe fresh, repairing Visual Studio, Uninstalling and Reinstalling the NuGet Package manager and clearing the NuGet cache.
Here is the output from running NuGet restore ..\mySolution.sln on the command line:
Restoring NuGet package RestSharp.102.7.0.
Restoring NuGet package Rx-Core.2.2.5.
Restoring NuGet package Rx-Interfaces.2.2.5.
Restoring NuGet package Newtonsoft.Json.4.0.8.
Restoring NuGet package Rx-Linq.2.2.5.
Restoring NuGet package Rx-Main.2.2.5.
Restoring NuGet package Rx-PlatformServices.2.2.5.
Restoring NuGet package Rx-WPF.2.2.5.
Restoring NuGet package Rx-XAML.2.2.5.
Restoring NuGet package LiveCharts.0.6.5.
Restoring NuGet package CommandLineParser.1.9.71.
WARNING: Package contains multiple nuspec files.
Errors in packages.config projects
Package contains multiple nuspec files.
NuGet Config files used:
C:\Users\Rob\AppData\Roaming\NuGet\NuGet.Config
C:\ProgramData\nuget\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
C:\Users\Rob\AppData\Local\NuGet\Cache
C:\Users\Rob.nuget\packages\
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
Running "Nuget.exe locals all -clear" fixed this

Nuget Package Manager for single project fails to load after adding RingCentralSDK

I'm on VS 2015, targeting .net 4.5.2, my "Nuget Package Manager for Visual Studio" in Extensions and Updates shows 3.4.4.1321.
I added all dependencies of RingCentralSDK package separately:
Microsoft.Bcl
Microsoft.Bcl.Async
Microsoft.Bcl.Build
Microsoft.Net.Http
Newtonsoft.Json
Portable.BouncyCastle-Signed
PubnubPCL
Then I right click on my project, pick "Manage Nuget Packages...", the tab opens, in the "Installed" subtab I can see the 7 packages.
Now, I install the RingCentralSDK package. My output is fine:
Attempting to gather dependency information for package 'RingCentralSDK.1.0.0' with respect to project 'MyProj', targeting '.NETFramework,Version=v4.5.2'
Attempting to resolve dependencies for package 'RingCentralSDK.1.0.0' with DependencyBehavior 'Lowest'
Resolving actions to install package 'RingCentralSDK.1.0.0'
Resolved actions to install package 'RingCentralSDK.1.0.0'
Adding package 'RingCentralSDK.1.0.0' to folder 'C:\code\packages'
Added package 'RingCentralSDK.1.0.0' to folder 'C:\code\packages'
Added package 'RingCentralSDK.1.0.0' to 'packages.config'
Successfully installed 'RingCentralSDK 1.0.0' to MyProj
========== Finished ==========
Now, I check again the Manage Nuget Packages for this specific project, and instead of seeing the list of packages, I get a yellow band:
Error occured Show erros in output Dismiss
And in the "Package Manager" output, the error is:
ZIP archive contains unsupported data structures.
In my packages folder, the folder "RingCentralSDK.1.0.0" seems ok, but then I don't anything about nuget packages format.
I cannot uninstall RingCentral via the package manager as it's not showing, not any other one, which is really annoying. I had an error when trying to do it via the command line. I reverted my changes (or remove the line in packages.config for my project), and the Nuget Package Manager tab works fine again. This is also affecting the "Managet Nuget Packages for Solution".
What can I do to fix this?
Fixed in RingCentralSDK 1.0.1-alpha1
It turns out that the NuGet package created on Mac is not compatible with Visual Studio NuGet GUI tool.
You can install the latest version by
Install-Package RingCentralSDK -Pre
Or if you prefer GUI:
Update:
For projects which already have 1.0.0 version installed, how to upgrade?
Today I did some testing and I came to the following conclusion:
New project will have no problem with 1.0.1 version or later
For old project which have 1.0.0 installed. You need to follow the following steps:
UnInstall RingCentralSDK 1.0.0
Close VS
Delete packages folder in your project
Delete packages folder in ~/.nuget/
Launch VS
Install RingCentralSDK 1.0.1
I need to do the above because nuget has cache. If I don't do it the problem just persists. I don't know the exactly reason but the above steps did work for me.

Nuget not reinstalling packages

I have modified the target .net framework to use 4.5 from 4.0. I got a message from nuget that packages need to re-installed so ran Update-Package -Reinstall -ProjectName https://localhost/SomeWebProject/. As nuget was executing, it spitted out yellow warning signs that looked like this:
Skipped reinstalling package 'NLog 3.1.0.0' in project 'SomeWebProject' because the package does not exist in the package source.
Why aren't my packages being reinstalled? I went into my packages folder and verified NLog 3.1.0.0 exist!
Turns out the solution is hiding in plain sight.
All we have to do is set the Package Source in the Package Manager Console window. (Credits to Matt Ward for pointing it out.)
Or you may run the following NuGet Package Management command:
'Update-Package -reinstall'
This command will reinstall all your solutions NuGet packages without updating the version(s) of existing packages.