I need to update a package Package01, which lives in a private source, for multiple projects in a solution from version 1.0.1 to newest version 1.1.0. If doing this update from Package Manager UI, this step needs to be repeated many times.
Is it possible to do just in one step? Thanks for any suggestion.
You can update a package for all projects in a solution from the Package Manager UI or from the Package Manager Console.
Using the Manage Packages dialog right click the solution and select Manage Packages for the solution. Then update the package. You will be able to update it for multiple projects in one step.
You can also do a similar thing from the Package Manager Console. The command below will update jquery to the latest version for all projects in the solution.
Update-Package jquery
There is more documentation on the Update-Command on the NuGet web site.
Related
I have a problem updating the Nuget packages. I had to install my Visual Studio in a new environment and new is also Azure DevOps. Previously we had the TFS.
Meanwhile I have some packages on the Azure DevOps that I need for my Solution. In addition, packages from Nuget.org are still needed.
In my solution older versions of the Nuget packages are included. Some packages I can't update for some reasons.
Now I have a Nuget package that needs to be updated and here comes my problem. When I go to Tools --> Manage Nuget Package for Solutions... and click on Install, it brings me in the Preview Changes overview all packages that have an older version and wants to update all of them.
Where can I set it or what do I have to do, so that only the one package is updated, which I have selected? In my old environment it works normally.
Thanks.
Cheers
If you want to update one package for all the projects under the solution, you should right-click on the solution-->Manage Nuget Packages for Solution
This will update the package of all selected projects to one same version.
You could also right-click on the project-->Manage nuget packages to update the package one by one. It is definitely not as flexible as the above one .
I have setup a new team project on VSTS for our development team and am using the Package-Management extension for publishing our NuGet packages.
I have also enabled the public nuget.org feed as an upstream source for our internal package feed.
As recommended here & here I have unchecked nuget.org as a package source within Visual Studio.
Now I expect the search to find packages published to this feed first
and if not then fetch it from the upstream.
But this is not the case and am unable to add packages from nuget.org
unless I enable nuget.org as a package source from within Visual Studio.
Packages from nuget.org (that where added by enabling nuget.org) start appearing in my private feed once I publish packages to my feed.(even after I uncheck nuget.org source)
But I can't consume new packages directly from the upstream without enabling nuget.org as a source.
Have I misunderstood this is this supposed to be a build machine configuration rather than a developer machine configuration?
You missed this section in the documentation:
If you're using upstream sources, package-versions in the upstream
source that haven't yet been saved into your feed (by using them at
least once) won't appear in the NuGet Package Manager search. To
install these packages:
On the upstream source (e.g. nuget.org), copy the Install-Package
command.
In Visual Studio, open the Package Manager Console from Tools -> NuGet Package Manager.
Paste the Install-Package command into the Package Manager Console and run it.
In Visual Studio (I'm using VS 2019), updated versions of packages from upstream should appear in the dropdowns automatically, except in the following case:
If PackageA depends on PacakageB, but PackageB is not explicitly installed (i.e. you didn't add it explicitly in your project's Manage NuGet Packages page), then PackageB will be frozen at the last version that was implicitly installed.
Example:
On your Manage NuGet Packages page you install System.Text.Json version 5.0.0. This causes your app to be implicitly dependent on System.Text.Encodings.Web 5.0.0.
Some time later, you upgrade System.Text.Json to version 5.0.1. There is also a new version 5.0.1 of System.Text.Encodings.Web, but since System.Text.Json 5.0.1 depends on System.Text.Encodings.Web >= 5.0.0, the version already in your feed satisfies the implicit dependency. Your feed will keep version 5.0.0.
Sometime later you need to update to System.Text.Encodings.Web version 5.0.1. You search for System.Text.Encodings.Web on the NuGet package page, but notice that version 5.0.0 is the only version available!
Solution
4.1. Click Install on version 5.0.0. This will make the package an explicit dependency.
4.2. Now, on the updates tab, you will see 5.0.1 appear as an update option.
As you found, you do should also select nuget.org package source (both select you VSTS feed and nuget.org as package sources).
If you un-select nuget.org package source in VS, that means packages from nuget.org won’t be available.
For the purpose to search a package from VSTS feed first, and then search in nuget.org, you can achieve it by filtering packages from different package sources:
To search a package (such as NUnit package) from VSTS feed (the name is new for below example) first:
Sepecifying Package source as new, if there shows the related package(s) in browse list, then you can use the package(s) from VSTS feed. If there has no packages list, that means VSTS feed does not have related packages, then you can serarch from nuget.org as below step.
To serach the package (NUnit) from nuget.org, you just need to change the package source as nuget.org, then VS will list related packages which store in https://api.nuget.org/v3/index.json.
I have just added a package to a newer project, and its version has increased. Now I would like to have all the projects that use that package use the newer version. Is it possible for NuGet or a script to do this?
In solution node, select 'Manage NuGet Packages for Solutions' in context menu.
For each package, click 'Manage' button and choose project to use this package.
Then update package in 'Manage NuGet Packages for Solutions' window, packages are updated for all projects.
I have a solution, where I use Nuget for managing my packages.
Using Nuget, I have installed ie. entity framework in X projects in a solution. After, I have added a new project, and I want to install the entity framework in my new project.
However, when I open the nuget package manager, I cannot click install on existing packages I use. So how do I install the entity framework in my new projects?
Easiest way would be to use Package Manager Console. Just select your project from the dropdown and run this command:
Install-Package EntityFramework
You can also use Manage NuGet Packages for Solution dialog, maybe that won't show those packages as installed.
We have a very project, and we decided to build it's core as a set of NuGet dependencies using TeamCity. And now we want to import those NuGet packages to the rest of project.
Core can be updated several times a day, and project must use only the latest version. But when we removed version specification or set it as version="", it still used the old version.
So, we want our project to use the latest libraries on each build. Can you post some recomendations?
If you can rely on just TeamCity you could take a look at the NuGet update options that TeamCity provides. They have build options such as Update packages with help of NuGet update command which you could try.
If you want something similar when you build on a developer's machine then you will need to look at some pre-build step that uses NuGet update.