### Install package via PowerShell Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/release-notes/Known-Issues.md Example of a package installation command that may fail with a FormatException if VSLangProj.dll is unregistered. ```powershell install-package log4net Installing 'log4net 2.0.0'. Successfully installed 'log4net 2.0.0'. Adding 'log4net 2.0.0' to Tyson.OperatorUpload. Install failed. Rolling back... install-package : Input string was not in a correct format. At line:1 char:1 install-package log4net ~~~~~~~~~~~~~~~~~~~~~~~ CategoryInfo : NotSpecified: (:) [Install-Package], FormatException FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand ``` -------------------------------- ### NuGet CLI init command examples Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/cli-reference/cli-ref-init.md Examples showing local and UNC path usage for package initialization. ```cli nuget init c:\foo c:\bar nuget init \\foo\packages \\bar\packages -Expand ``` -------------------------------- ### Add-BindingRedirect Usage Examples Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/ps-reference/ps-ref-add-bindingredirect.md Examples showing how to specify the project name when running the command. ```ps Add-BindingRedirect MyProject Add-BindingRedirect -ProjectName MyProject ``` -------------------------------- ### NuGet CLI add command examples Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/cli-reference/cli-ref-add.md Examples of adding a package to a local directory or a UNC network share. ```cli nuget add foo.nupkg -Source c:\bar\ ``` ```cli nuget add foo.nupkg -Source \\bar\packages\ ``` -------------------------------- ### NuGet CLI search command examples Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/cli-reference/cli-ref-search.md Various examples demonstrating how to search for packages with different filters and options. ```cli nuget search logging ``` ```cli nuget search logging -Verbosity detailed ``` ```cli nuget search logging -Take 5 ``` ```cli nuget search JSON -PreRelease -Source "https://api.nuget.org/v3/index.json" ``` ```cli nuget search JSON -Source "https://api.nuget.org/v3/index.json" -Source "https://other-feed-url-goes-here" ``` -------------------------------- ### Example multi-targeting project file Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/create-packages/multiple-target-frameworks-project-file.md A complete example of an SDK-style project file configured for multiple target frameworks. ```xml netstandard2.0;net45 Sample project that targets multiple TFMs ``` -------------------------------- ### Sample Request to Enumerate Package Versions Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/api/package-base-address-resource.md Example of a GET request to the package content API to list all versions of the 'owin' package. Remember to fetch the base URL from the service index. ```http GET https://api.nuget.org/v3-flatcontainer/owin/index.json ``` -------------------------------- ### Sample Request for Repository Signatures Index Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/api/repository-signatures-resource.md An example GET request to fetch the repository signatures index for a specific version. ```http GET https://api.nuget.org/v3-index/repository-signatures/5.0.0/index.json ``` -------------------------------- ### Open-PackagePage Usage Examples Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/ps-reference/ps-ref-open-packagepage.md Examples showing how to open specific package pages or capture the URL without launching the browser. ```ps # Opens a browser with the Ninject package's project page Open-PackagePage Ninject # Opens a browser with the Ninject package's license page Open-PackagePage Ninject -License # Opens a browser with the Ninject package's report abuse page Open-PackagePage Ninject -ReportAbuse # Assigns the license URL to the variable, $url, without launching the browser $url = Open-PackagePage Ninject -License -PassThru -WhatIf ``` -------------------------------- ### Example framework-specific folder structure Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/create-packages/Supporting-Multiple-Target-Frameworks.md A concrete example of a folder structure supporting four different framework versions. ```text \lib \net46 \MyAssembly.dll \net461 \MyAssembly.dll \uap \MyAssembly.dll \netcore \MyAssembly.dll ``` -------------------------------- ### Transitive Pinning Dependency Configuration Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/consume-packages/Central-Package-Management.md Example setup for central package versions and project-level transitive pinning. ```xml ``` ```xml true net6.0 ``` -------------------------------- ### NuGet CLI verify command examples Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/cli-reference/cli-ref-verify.md Various examples demonstrating signature verification, certificate fingerprint filtering, and verbosity settings. ```cli nuget verify -Signatures .\..\MyPackage.nupkg -CertificateFingerprint "CE40881FF5F0AD3E58965DA20A9F571EF1651A56933748E1BF1C99E537C4E039;5F874AAF47BCB268A19357364E7FBB09D6BF9E8A93E1229909AC5CAC865802E2" -Verbosity detailed nuget verify -Signatures c:\packages\MyPackage.nupkg -CertificateFingerprint CE40881FF5F0AD3E58965DA20A9F571EF1651A56933748E1BF1C99E537C4E039 nuget verify -Signatures MyPackage.nupkg -Verbosity quiet nuget verify -Signatures .\*.nupkg nuget verify -All .\*.nupkg ``` -------------------------------- ### Install Pre-release Package using NuGet CLI Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/create-packages/Prerelease-Packages.md Use the `-prerelease` switch with the `install` command in the NuGet CLI to install pre-release versions of a package. ```bash nuget install -prerelease ``` -------------------------------- ### NuGet CLI delete command examples Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/cli-reference/cli-ref-delete.md Examples showing package deletion with default settings and with explicit source and API key parameters. ```cli nuget delete MyPackage 1.0 nuget delete MyPackage 1.0 -Source http://package.contoso.com/source -apikey A1B2C3 ``` -------------------------------- ### Install Command Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/cli-reference/cli-ref-install.md Downloads and installs a package into a project, defaulting to the current folder, using specified package sources. ```APIDOC ## nuget install ### Description Downloads and installs a package into a project, defaulting to the current folder, using specified package sources. ### Method CLI Command ### Endpoint nuget install [options] ### Parameters #### Path Parameters - **packageID** (string) - Required - The ID of the package to install (uses the latest version by default). - **configFilePath** (string) - Required - The path to the `packages.config` file that lists the packages to install. #### Query Parameters - **-ConfigFile** (string) - Optional - The NuGet configuration file to apply. If not specified, the default configuration file is used. - **-DependencyVersion** (string) - Optional (4.4+) - Specifies the version of the dependency packages to use. Can be one of: Lowest, HighestPatch, HighestMinor, Highest, Ignore. - **-DirectDownload** - Optional - Downloads directly without populating any caches with metadata or binaries. - **-DisableParallelProcessing** - Optional - Disables installing multiple packages in parallel. - **-x|-ExcludeVersion** - Optional - Installs the package to a folder named with only the package name and not the version number. - **-FallbackSource** (string) - Optional (3.2+) - A list of package sources to use as fallbacks in case the package isn't found in the primary or default source. - **-ForceEnglishOutput** - Optional (3.5+) - Forces nuget.exe to run using an invariant, English-based culture. - **-Framework** (string) - Optional (4.4+) - Target framework used for selecting dependencies. Defaults to 'Any' if not specified. - **-?|-help** - Optional - Displays help information for the command. - **-NoHttpCache** - Optional - Prevents NuGet from using http cached packages. - **-NonInteractive** - Optional - Suppresses prompts for user input or confirmations. - **-OutputDirectory** (string) - Optional - Specifies the folder in which packages are installed. If no folder is specified, the current folder is used. - **-PackageSaveMode** (string) - Optional - Specifies the types of files to save after package installation: one of `nuspec`, `nupkg`, or `nuspec;nupkg`. - **-PreRelease** - Optional - Allows prerelease packages to be installed. - **-RequireConsent** - Optional - Verifies that restoring packages is enabled before downloading and installing the packages. - **-SolutionDirectory** (string) - Optional - Specifies the root folder of the solution for which to restore packages. - **-Source** (string) - Optional - Specifies the list of package sources (as URLs) to use. If omitted, the command uses the sources provided in configuration files. - **-Verbosity** (string) - Optional - Specifies the amount of detail displayed in the output. Can be `normal`, `quiet`, or `detailed`. - **-Version** (string) - Optional - Specifies the version of the package to install. ### Request Example ```cli nuget install elmah nuget install packages.config nuget install ninject -OutputDirectory c:\proj ``` ### Response #### Success Response (0) - **Output** (string) - Standard output from the command. #### Error Response - **Error** (string) - Error message if the command fails. ``` -------------------------------- ### Install NuGet packages via CLI Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/consume-packages/install-use-packages-nuget-cli.md Use the install command to download packages to a specified directory or based on a configuration file. ```cli nuget install -OutputDirectory ``` ```cli nuget install Newtonsoft.Json -OutputDirectory packages ``` ```cli nuget install packages.config ``` ```cli nuget install config\packages.config -OutputDirectory packages ``` -------------------------------- ### Install package from a local .nupkg file Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/ps-reference/ps-ref-install-package.md Installs a package using a local `.nupkg` file. The path to the file must be correct. ```powershell # Installs jquery 1.10.2 package, using the .nupkg file under local path of c:\temp\packages Install-Package c:\temp\packages\jQuery.1.10.2.nupkg ``` -------------------------------- ### Install a NuGet Package (Older .NET Versions) Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/consume-packages/install-use-packages-dotnet-cli.md For .NET 9 or earlier, use the verb-first command syntax to add a package reference and install the package. ```dotnetcli dotnet add package ``` -------------------------------- ### NuGet Package Search Syntax Examples Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/consume-packages/Finding-and-Choosing-Packages.md Examples of property-based search queries for filtering NuGet packages by ID, tags, and other metadata. ```text id:NuGet.Core ``` ```text ID:nuget.core ``` ```text Id:NUGET.CORE ``` ```text PackageId:jquery ``` ```text Id:jquery ``` ```text id:jquery id:ui ``` ```text id:jquery tags:validation ``` ```text invalid:jquery ui ``` ```text invalid:jquery ``` -------------------------------- ### Install Package from Disk Folder Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/visual-studio-extensibility/nuget-api-in-visual-studio.md Installs one or more packages that exist on disk in a folder defined by a registry key. It supports pre-unzipped packages. ```cs void InstallPackage(string keyName, bool isPreUnzipped); ``` -------------------------------- ### Install Package with Repository and Skip References (Obsolete) Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/visual-studio-extensibility/nuget-api-in-visual-studio.md Installs a single package from a specified IPackageRepository. This overload is obsolete and includes an option to skip assembly references. ```cs void InstallPackage(IPackageRepository repository, Project project, string packageId, string version, bool ignoreDependencies, bool skipAssemblyReferences); ``` -------------------------------- ### Install Package with String Version Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/visual-studio-extensibility/nuget-api-in-visual-studio.md Installs a single package using a string for the version. This overload supports SemVer pre-release versions and can be called from a background thread. ```cs void InstallPackage(string source, Project project, string packageId, string version, bool ignoreDependencies); ``` -------------------------------- ### Example Project with System.Text.Json Reference Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/consume-packages/Package-References-in-Project-Files.md A sample project file demonstrating a direct PackageReference to System.Text.Json, which might be pruned. ```xml net9.0;netstandard2.0 ``` -------------------------------- ### Get NuGet Brokered Service Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/visual-studio-extensibility/nuget-api-in-visual-studio.md Use IAsyncServiceProvider to obtain the service broker and then get a proxy to the INuGetProjectService. Ensure the NuGet.VisualStudio.Contracts package is installed. ```csharp // Your AsyncPackage implements IAsyncServiceProvider IAsyncServiceProvider asyncServiceProvider = this; var brokeredServiceContainer = await asyncServiceProvider.GetServiceAsync(); var serviceBroker = brokeredServiceContainer.GetFullAccessServiceBroker(); var nugetProjectService = await serviceBroker.GetProxyAsync(NuGetServices.NuGetProjectServiceV1); ``` -------------------------------- ### List Installed Packages (NuGet) Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/ps-reference/ps-ref-get-package.md Retrieves the list of packages installed in the default project within the current solution. No setup or imports are required if running within the Visual Studio Package Manager Console. ```powershell Get-Package ``` -------------------------------- ### Example nuget.config File Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/nuget-config-file.md This XML file demonstrates a comprehensive configuration for the NuGet client, including package repository paths, default push sources, proxy settings, package restore options, package source mappings, API keys, and trusted signers. ```xml microsoft;aspnet;nuget ``` -------------------------------- ### Nuspec with Framework Assemblies Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/nuspec.md An example .nuspec file that specifies framework assemblies, which are .NET Framework assemblies that a package depends on. These are installed for specific project targets. ```xml PackageWithGacReferences 1.0 Author here false A package that has framework assemblyReferences depending on the target framework. ``` -------------------------------- ### NuGet CLI help command examples Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/cli-reference/cli-ref-help.md Common usage patterns for retrieving help information, including specific commands and formatting options. ```cli nuget help nuget help push nuget ? nuget push -? nuget help -All -Markdown ``` -------------------------------- ### Get Project Information (PowerShell) Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/ps-reference/ps-ref-get-project.md Use this command to display information about the default project in the Package Manager Console. No specific setup is required beyond being in the console. ```powershell # Displays information for the default project Get-Project ``` -------------------------------- ### NuGet Binding Redirects Configuration Example Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/nuget-config-file.md This snippet demonstrates how to configure binding redirects in a nuget.config file, specifically to skip automatic binding redirects when packages are installed. ```xml ``` -------------------------------- ### Package Source Mapping Example Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/nuget-config-file.md Defines package source mappings to control which sources are used for specific packages. The 'contoso.com' source is mapped to packages starting with 'Contoso.'. ```xml ``` -------------------------------- ### Initialize Directory.Packages.props via CLI Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/consume-packages/Central-Package-Management.md Use the .NET CLI to generate the initial configuration file at the repository root. ```shell dotnet new packagesprops ``` -------------------------------- ### Package README Template Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/nuget-org/package-readme-on-nuget-org.md A template for structuring a package readme file on NuGet.org, including sections for introduction, getting started, usage with code snippets, additional documentation, and feedback. ```text # Package readme title, e.g., display name or title of the package (optional) Start with a clear and concise description: A brief overview of what your package is and does, also what problem it solves. ## Getting started Explain how to use your package, provide clear and concise getting started instructions, including any necessary steps. ### Prerequisites What are specific minimum requirements to use your packages? Consider excluding this section if your package works without any additional setup beyond simple package installation. ## Usage Examples about how to use your package by providing code snippets/example images, or samples links on GitHub if applicable. - Provide sample code using code snippets - Include screenshots, diagrams, or other visual help users better understand how to use your package ## Additional documentation Provide links to more resources: List links such as detailed documentation, tutorial videos, blog posts, or any other relevant documentation to help users get the most out of your package. ## Feedback Where and how users can leave feedback? - Links to a GitHub repository where could open issues, Twitter, a Discord channel, bug tracker, or other platforms where a package consumer can connect with the package author. ``` -------------------------------- ### Example NuGetDefaults.Config Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/consume-packages/configuring-nuget-behavior.md This XML configuration file demonstrates how to set default package sources, disable specific sources, and define a default push source for NuGet operations. ```xml ``` -------------------------------- ### Complete SDK-style project file for NuGet packaging Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/create-packages/creating-a-package-msbuild.md A full example of an SDK-style project file configured with required NuGet package metadata. ```xml netstandard2.0 ClassLibDotNetStandard 1.0.0 your_name your_company ``` -------------------------------- ### Installed Package Log Message Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/concepts/troubleshooting-installed-packages.md Starting from NuGet 5.9.0, this message is output during package restore, indicating the package name, version, source, and content hash. This message is visible at normal verbosity, which is the default for msbuild and nuget CLI tools. ```text Installed Moq 4.16.1 from https://api.nuget.org/v3/index.json with content hash bw3R9q8cVNhWXNpnvWb0OGP4HadS4zvClq+T1zf7AF+tLY1haZ2AvbHidQekf4PDv1T40c6brZeT/V0IBq7cEQ==. ``` -------------------------------- ### Install a specific package Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/cli-reference/cli-ref-install.md Use this command to download and install a specific package by its ID. By default, the latest version is installed. ```cli nuget install elmah ``` -------------------------------- ### Install NuGet Package from Local Source Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/create-packages/Creating-a-Package.md Install a package from a specific local source using the `nuget install` command. Ensure `` matches the source name added previously. This command installs the package only from the specified source. ```cli nuget install -source ``` -------------------------------- ### Install package to a specific output directory Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/cli-reference/cli-ref-install.md Use this command to install a package and specify a different directory for the installed files using the `-OutputDirectory` option. ```cli nuget install ninject -OutputDirectory c:\proj ``` -------------------------------- ### Basic packages.config example Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/packages-config.md A simple configuration file referencing two package dependencies. ```xml ``` -------------------------------- ### NuGet CLI list command examples Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/cli-reference/cli-ref-list.md Common usage patterns for listing packages from feeds. ```cli nuget list ``` ```cli nuget list Azure -Verbosity detailed ``` ```cli nuget list Azure -AllVersions ``` ```cli nuget list JSON -AllVersions -Source "https://nuget.org/api/v2" ``` ```cli nuget list JSON -Source "https://nuget.org/api/v2" -Source "https://other-feed-url-goes-here" ``` -------------------------------- ### IVsPackageInstallerServices Methods Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/visual-studio-extensibility/nuget-api-in-visual-studio.md Methods for querying installed NuGet packages and checking installation status in projects. ```APIDOC ## GetInstalledPackages ### Description Retrieves the list of NuGet packages installed in the current solution. ### Parameters None ### Response - **IEnumerable** - A collection of metadata for installed packages. ## IsPackageInstalled ### Description Checks if a NuGet package with the specified Id is installed in the specified project. ### Parameters #### Path Parameters - **project** (Project) - Required - The project to check for the NuGet package. - **id** (string) - Required - The id of the package to check. ### Response - **bool** - Returns true if the package is installed, false otherwise. ## IsPackageInstalled (Overload) ### Description Checks if a NuGet package with the specified Id and version is installed in the specified project. ### Parameters #### Path Parameters - **project** (Project) - Required - The project to check for the NuGet package. - **id** (string) - Required - The id of the package to check. - **version** (SemanticVersion) - Required - The version of the package to check. ### Response - **bool** - Returns true if the package is installed, false otherwise. ## IsPackageInstalledEx ### Description Checks if a NuGet package with the specified Id and version string is installed in the specified project. ### Parameters #### Path Parameters - **project** (Project) - Required - The project to check for the NuGet package. - **id** (string) - Required - The id of the package to check. - **versionString** (string) - Required - The version string of the package to check. ### Response - **bool** - Returns true if the package is installed, false otherwise. ``` -------------------------------- ### Example contentFiles Section in .nuspec Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/nuspec.md Demonstrates how to define content files, their build actions, and copy behaviors within the contentFiles element of a .nuspec file. ```xml ... ``` -------------------------------- ### Install a package to a specific project Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/consume-packages/install-use-packages-powershell.md Install a package into a project other than the default using the -ProjectName option. ```powershell Install-Package Elmah.MVC -ProjectName UtilitiesLib ``` -------------------------------- ### Generate initial manifest Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/quickstart/create-and-publish-a-package-using-visual-studio-net-framework.md Use the spec command to create a .nuspec file from an existing project file. ```cli nuget spec AppLogger.csproj ``` -------------------------------- ### Install Packages from Extension Repository Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/visual-studio-extensibility/nuget-api-in-visual-studio.md Installs packages from the Visual Studio Extension repository. Use this method to install multiple packages with specific versions into a target project, with options to ignore dependencies and skip assembly references. ```csharp void InstallPackagesFromVSExtensionRepository(string extensionId, bool isPreUnzipped, bool skipAssemblyReferences, bool ignoreDependencies, Project project, IDictionary packageVersions); ``` -------------------------------- ### Install latest package version Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/ps-reference/ps-ref-install-package.md Installs the latest version of a package from the current source into the default project. ```powershell # Installs the latest version of Elmah from the current source into the default project Install-Package Elmah ``` -------------------------------- ### Install specific package version via CLI Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/consume-packages/install-use-packages-nuget-cli.md Specify a version number to install a release other than the latest. ```cli nuget install -Version ``` ```cli nuget install Newtonsoft.Json -Version 12.0.1 ``` -------------------------------- ### Package Folder Structure Examples Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/nuspec.md Illustrates common ways to structure content files within a NuGet package using the contentFiles directory. ```text /contentFiles/any/any/config.xml /contentFiles/any/net45/config.xml /contentFiles/cs/net45/sample.cs ``` ```text /contentFiles/vb/any/code.vb /contentFiles/cs/any/_._ ``` -------------------------------- ### Benchmarking Different Package Versions with Multi-Targeting Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/consume-packages/Package-References-in-Project-Files.md Set up multi-targeting to benchmark different versions of a package. This example defines 'benchmark7.0' and 'benchmark8.0' and conditionally includes package versions based on the target framework. ```xml benchmark7.0;benchmark8.0 ``` -------------------------------- ### NuGet CLI init command usage Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/cli-reference/cli-ref-init.md Basic syntax for the init command requiring a source folder and a destination folder. ```cli nuget init [options] ``` -------------------------------- ### Initialize a Local Feed with Multiple Packages Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/hosting-packages/Local-Feeds.md Use the `nuget init` command to efficiently copy all packages from a specified folder into a hierarchical feed. This command automates the process of adding multiple packages to the feed. ```cli nuget init c:\packages \\myserver\packages ``` -------------------------------- ### CLI Command: nuget init Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/cli-reference/cli-ref-init.md Copies packages from a source folder to a destination folder using a hierarchical layout. ```APIDOC ## CLI Command: nuget init ### Description Copies all the packages from a flat folder to a destination folder using a hierarchical layout. This is equivalent to using the add command on each package in the folder. ### Usage `nuget init [options]` ### Parameters #### Positional Parameters - **source** (string) - Required - The folder containing packages. - **destination** (string) - Required - The local folder or UNC pathname to which the packages are copied. #### Options - **-ConfigFile** (string) - Optional - The NuGet configuration file to apply. - **-Expand** (flag) - Optional - Adds all files in each package that's added to the package source. - **-ForceEnglishOutput** (flag) - Optional - Forces nuget.exe to run using an invariant, English-based culture (3.5+). - **-?|-help** (flag) - Optional - Displays help information for the command. - **-NonInteractive** (flag) - Optional - Suppresses prompts for user input or confirmations. - **-Verbosity** (string) - Optional - Specifies the amount of detail displayed in the output: normal, quiet, or detailed. ### Request Example `nuget init c:\\foo c:\\bar` `nuget init \\\\foo\\packages \\\\bar\\packages -Expand` ``` -------------------------------- ### NuGet Configuration Settings Example Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/nuget-config-file.md This snippet shows how to configure various settings within the `` section of a nuget.config file, such as default push source, package folders, proxy settings, and signature validation. ```xml ``` -------------------------------- ### Publish command output Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/quickstart/create-and-publish-a-package-using-visual-studio-net-framework.md Example output displayed after a successful package push. ```output Pushing to 'https://www.nuget.org/api/v2/package'... PUT https://www.nuget.org/api/v2/package/ Created https://www.nuget.org/api/v2/package/ 6829ms Your package was pushed. ``` -------------------------------- ### Install packages from packages.config Source: https://github.com/nuget/docs.microsoft.com-nuget/blob/main/docs/reference/cli-reference/cli-ref-install.md Use this command to install all packages listed in a `packages.config` file. This is useful for restoring all project dependencies. ```cli nuget install packages.config ```