Package Restore drops pending zero, installing package does not - visual-studio

We have an internal NuGet feed, one of the packages is EPPlus.3.1.3.0.nupkg. Inside the package, EPPlus.nuspec file contains <version>3.1.3.0</version> and the file under package\services\metadata\core-properties\contains <version>3.1.3.0</version>.
In the package browser, it's listed as Version: 3.1.3.0. When installing this package, it is placed under packages\EPPlus.3.1.3.0. The .csproj file contains <HintPath>..\packages\EPPlus.3.1.3.0\lib\net20\EPPlus.dll</HintPath>.
When restoring the package, it's instead restored under packages\EPPlus.3.1.3. This causes the build to fail. Removing and reinstalling the package makes the build work again.
What's causing this issue?

The official NuGet repository also hosts this package, but it uses version 3.1.3 instead of 3.1.3.0
Package restore checks all your feeds in a certain order, which can be set under Options -> NuGet Package Manager -> Package Sources by clicking arrow buttons. If the official repository is listed above your internal feed, it will instead try to restore the package from there.
So while theoretically both packages should hold the same version, the project will indeed fail to build. I've raised a bug report here.

Related

Why am I getting Warning NU1605, which appeared out of the clear blue

I had a working app when suddenly I got this warning:
"Warning NU1605 Detected package downgrade: Microsoft.NETCore.UniversalWindowsPlatform from 6.2.9 to 6.1.9."
In trying to figure out what is going on, I found that a new project with no added code will get this error too.
I also found that I could open the .csproj file in Notepad and change the line from 6.1.9 to 6.2.9 but wonder why I have to do this or what else I should be doing.
"Warning NU1605 Detected package downgrade: Microsoft.NETCore.UniversalWindowsPlatform from 6.2.9 to 6.1.9."
From shared warnning log, you need to update Nuget Package (Microsoft.NETCore.UniversalWindowsPlatform) form 6.1.9 to 6.2.9.
About updating can follow bellow steps:
Click Tools-> Nuget Package Manager -> Manange Nuget Packages for Solution...
Then in Installed will see the nuget package there:
Select the neeed version to install:

Add NuGet package (ie. xunit.runner.console) at solution level

I need a NuGet (example xunit.runner.console) to run UT from command line.
Right now in one of project I have added xunit.runner.console as dependency so it is downloaded, path is known and I can use it in my build script.
This Project was removed and build-script is broken now. I will need to add it to another project, but the same situation can occur again (or other reasons).
I there a way to download this package but don't link it with concrete project?
You can install the nuget cli and then get the package needed using the build script. So, to answer your question, you can just use it in the build script and fetch the package before starting to build your project.

Nuget error install package Microsoft.NETCore.UniversalWindowsPlatform

I have a problem with the update Microsoft.NETCore.UniversalWindowsPlatform.
There was version 5.0.0, when you start the development environment, the management offered me a package to update components. All components are successfully updated, except that package. I just receive the message: "Failed to recovery package. Package rollback changes to ***." What to do with this problem, I do not know. Inet clambered, tried to remove the package and put again (by removing the package is not compromised with the same error).
For this error like the following screen shot, two suggestions:
(1)Tools > Options > Projects and Solutions > General, please checked "Save new projects when created" option.
(2)Install the latest packages:
Install-Package Microsoft.NETCore.UniversalWindowsPlatform
https://www.nuget.org/packages/Microsoft.NETCore.UniversalWindowsPlatform/5.2.2

Nuget install local package fails when referencing external package has metadata only (no lib)

I am trying to build a local package with Nuget. My library uses several installed packages including "Microsoft.AspNet.WebApi.OwinSelfHost". The OwinSelfHost package only has a .nupkg file and not a corresponding lib or content folders. Nuget fails trying to find the .lib files that does not exist for that package. Here is the call and the output:
nuget.exe install NCR.AS.MGC.ClientProxies -Source C:\Sandbox\MGC\Mgc.ClientProxies\bin\Debug -OutputDirectory C:\Sandbox\MGC\packages.out -ExcludeVersion -NoCache
Unable to resolve dependency 'Microsoft.AspNet.WebApi.OwinSelfHost'. Source(s) used: 'nuget.org', 'NugetServer'.
Feeds used: C:\Sandbox\MGC\Mgc.ClientProxies\bin\Debug Attempting to gather dependencies information for package 'NCR.AS.MGC.ClientProxies.1.0.0' with respect to project 'C:\Sandbox\MGC\packages.out', targeting 'Any,Version=v0.0' Attempting to resolve dependencies for package 'NCR.AS.MGC.ClientProxies.1.0.0' with DependencyBehavior 'Lowest'
Any suggestions on creating the local package?
So I figured it out thanks to the help of a coworker that experienced this issue before. The packages that were installed from the Nuget Package Manager where placed in c:\Sandbox\MGC\packages. I was trying to build a local package that has my code which leverages some of the installed packages and have it write the local package in c:\Sandbox\MGC\packages.out. If I write my output package in the same directory as my installed packages (c:\sandbox\MGC\packages) everything works without issue. As soon as I try to put my stuff in a separate directory, it fails trying to find some of my installed packages. To me, this seems to be a Nuget bug..

Nuget Clean Package Remove/Install

I'd like to remove an entire nuget package, and cleanly install it in my project again.
Sadly, for some reason it skips removing files that have been "modified", and then skips putting them in the project on reinstall, because they already exist.
Is there any flag i can set to unconditionally remove every single trace of a nuget package, alternatively overwrite all existing files?
Thanks.
Unfortunately at the moment, NuGet does not do what you want. During the uninstall process, NuGet will only delete content files if they have not been modified. And as you've noticed, the update process will not update files that were modified either.
The Uninstall-Package command does have a -Force option, but that is to "force" uninstall even if there are other packages that depend on this one.
We can certainly file this as an issue and perhaps incorporate it into a future version.
Another option would be to create a PowerShell script that will enumerate a package's contents, then allow you to delete all the content files. I'll see if there is a simple way to do this.
BTW: Perhaps you can figure out a better way to extend the existing content file other than modifying it directly. Especially since you're losing your changes when the package is updated.
You can now do what you want! (finally)
You need to first update to the latest NuGet (I think this feature was added around April 2013). Do this by going to Tools > Extensions and Updates and click on Updates to update nuget.
Then the -FileConflictAction parameter will allow you to overwrite files.
Install-Package Microsoft.jQuery.Unobtrusive.Validation -Version 2.0.30506.0 -FileConflictAction Overwrite
(PowerShell Command Reference for Install-Package)
The NuGet Version 1.6 HAS a remove package function!
http://docs.nuget.org/docs/release-notes/nuget-1.6
if the update of the extension fails (signatur missmatch), just uninstall and reinstall. this is a known problem.
I think this happened to me a few times. Go to the packages.config file that should be the root directory of your project and remove the insurgent (in your case the line with the package: SignalR). This will tell NuGet that the package was never installed.
Now you will be able to reinstall it through the repository, then uninstall it so everything is back to the way it was before you got into this mess. I am unsure how it is occurring.

Resources