Nuget Package Manager ^HOT^ Download

0 views
Skip to first unread message

Gregory Muench

unread,
Jan 25, 2024, 7:34:52 PM1/25/24
to naresima

NuGet is the package manager for .NET. The NuGet client tools provide the ability to produce and consume packages. The NuGet Gallery is the central package repository used by all package authors and consumers.

nuget package manager download


Download File ✒ ✒ ✒ https://t.co/QGDAS3KZZ7



Visual Studio 2017 and higher automatically includes NuGet Package Manager when a .NET-related workload is installed. To install it individually in Visual Studio Installer, select the Individual components tab, and then select NuGet package manager under Code tools .

Select the Browse tab to display packages by popularity from the currently selected source (see Package sources). To search for a specific package, use the search box on the upper left. Select a package from the list to display its information on the right pane, which enables you to select a version to install.

Visual Studio installs the package and its dependencies in the project. When installation is complete, the added packages appear on the Installed tab. You can also find packages in the Dependencies > Packages node of your project in Solution Explorer. After you install a package, you can refer to it in the project with a using statement.

(Optional) NuGet has two formats in which a project can use packages: PackageReference and packages.config. To set the default format, select Tools > Options, expand NuGet Package Manager, select General, and then choose the Default package management format. For more information, see Choose default package management format.

Select the Updates tab to see packages that have available updates from the selected Package source. Select Include prerelease to include prerelease packages in the update list.

For some packages, the Update button is disabled and the following message appears: Implicitly referenced by an SDK. To update the package, update the SDK to which it belongs. This message indicates that the package is part of a larger framework or SDK and can't be updated independently. Such packages are internally marked with True. For example, Microsoft.NETCore.App is part of the .NET Core SDK, and the package version is different than the version of the runtime framework used by the application. To download a new version of the .NET Core, update your .NET Core installation. For more information, see .NET Core metapackages and versioning. This scenario applies to the following commonly used packages:

Developers typically consider it bad practice to use different versions of the same NuGet package across different projects in the same solution. Visual Studio allows you to use a common version for your NuGet packages. To do so, use the Consolidate tab of the NuGet Package Manager window to discover where packages with distinct version numbers are used by different projects in the solution.

Visual Studio ignores the order of package sources, and uses the package from whichever source is the first to respond to a request. For more information, see Restore packages. For information about how to load a package from a specific source, see Package source mapping.

If a package source reappears after you delete it, it might be listed in a computer-level or user-level NuGet.config file. For the location of these files, see Common NuGet configurations. Remove the package source in the files by editing them manually or using the nuget sources command.

When you select a package, the NuGet Package Manager displays an expandable Options control below the Version selector. For most project types, only the Show preview window option is provided.

Force uninstall even if there are dependencies on it: When selected, uninstalls a package even if it's still being referenced in the project. This option is typically used in combination with Remove dependencies to remove a package and whatever dependencies it installed. Using this option may, however, lead to broken references in the project. In such a case, you might need to reinstall those other packages.

NuGet is the package manager for the Microsoft development platform including .NET. The NuGet client tools provide the ability to produce and consume packages. The NuGet Gallery (nuget.org) is the central package repository used by all package authors and consumers.

An essential tool for any modern development platform is a mechanism through which developers can create, share, and consume useful code. Often such code is bundled into "packages" that contain compiled code (as DLLs) along with other content needed in the projects that consume these packages.

For .NET (including .NET Core), the Microsoft-supported mechanism for sharing code is NuGet, which defines how packages for .NET are created, hosted, and consumed, and provides the tools for each of those roles.

Put simply, a NuGet package is a single ZIP file with the .nupkg extension that contains compiled code (DLLs), other files related to that code, and a descriptive manifest that includes information like the package's version number. Developers with code to share create packages and publish them to a public or private host. Package consumers obtain those packages from suitable hosts, add them to their projects, and then call a package's functionality in their project code. NuGet itself then handles all of the intermediate details.

Because NuGet supports private hosts alongside the public nuget.org host, you can use NuGet packages to share code that's exclusive to an organization or a work group. You can also use NuGet packages as a convenient way to factor your own code for use in nothing but your own projects. In short, a NuGet package is a shareable unit of code, but does not require nor imply any particular means of sharing.

In its role as a public host, NuGet itself maintains the central repository of over 100,000 unique packages at nuget.org. These packages are employed by millions of .NET/.NET Core developers every day. NuGet also enables you to host packages privately in the cloud (such as on Azure DevOps), on a private network, or even on just your local file system. By doing so, those packages are available to only those developers that have access to the host, giving you the ability to make packages available to a specific group of consumers. The options are explained on Hosting your own NuGet feeds. Through configuration options, you can also control exactly which hosts can be accessed by any given computer, thereby ensuring that packages are obtained from specific sources rather than a public repository like nuget.org.

Whatever its nature, a host serves as the point of connection between package creators and package consumers. Creators build useful NuGet packages and publish them to a host. Consumers then search for useful and compatible packages on accessible hosts, downloading and including those packages in their projects. Once installed in a project, the packages' APIs are available to the rest of the project code.

A "compatible" package means that it contains assemblies built for at least one target .NET framework that's compatible with the consuming project's target framework. Developers can create packages that are specific to one framework, as with UWP controls, or they can support a wider range of targets. To maximize a package's compatibility, developers target .NET Standard, which all .NET and .NET Core projects can consume. This is the most efficient means for both creators and consumers, as a single package (usually containing a single assembly) works for all consuming projects.

Package developers who require APIs outside of .NET Standard, on the other hand, create separate assemblies for the different target frameworks they want to support and include all of those assemblies in the same package (which is called "multi-targeting"). When a consumer installs such a package, NuGet extracts only those assemblies that are needed by the project. This minimizes the package's footprint in the final application and/or assemblies produced by that project. A multi-targeting package is, of course, more difficult for its creator to maintain.

As you can see, the NuGet tools you work with depend greatly on whether you're creating, consuming, or publishing packages, and the platform on which you're working. Package creators are typically also consumers, as they build on top of functionality that exists in other NuGet packages. And those packages, of course, may in turn depend on still others.

The ability to easily build on the work of others is one of most powerful features of a package management system. Accordingly, much of what NuGet does is managing that dependency tree or "graph" on behalf of a project. Simply said, you need only concern yourself with those packages that you're directly using in a project. If any of those packages themselves consume other packages (which can, in turn, consume still others), NuGet takes care of all those down-level dependencies.

Notice that some packages appear multiple times in the dependency graph. For example, there are three different consumers of package B, and each consumer might also specify a different version for that package (not shown). This is a common occurrence, especially for widely-used packages. NuGet fortunately does all the hard work to determine exactly which version of package B satisfies all consumers. NuGet then does the same for all other packages, no matter how deep the dependency graph.

Because projects can easily move between developer computers, source control repositories, build servers, and so forth, it's highly impractical to keep the binary assemblies of NuGet packages directly bound to a project. Doing so would make each copy of the project unnecessarily bloated (and thereby waste space in source control repositories). It would also make it very difficult to update package binaries to newer versions as updates would have to be applied across all copies of the project.

df19127ead
Reply all
Reply to author
Forward
0 new messages