Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to: package publishing • Supported versions: 3.3+
Adds a specified package to a non-HTTP package source (a folder or UNC path) in a hierarchical layout, wherein folders are created for the package ID and version number. For example:
\\myserver\packages
└─<packageID>
└─<version>
├─<packageID>.<version>.nupkg
├─<packageID>.<version>.nupkg.sha512
└─<packageID>.nuspec
When restoring or updating against the package source, hierarchical layout provides significantly better performance.
To expand all the files in the package to the destination package source, use the -Expand switch. This typically results in additional subfolders appearing in the destination, such as tools and lib.
Usage
nuget add <packagePath> -Source <sourcePath> [options]
where <packagePath> is the pathname to the package to add, and <sourcePath> specifies the folder-based package source to which the package will be added. HTTP sources are not supported.
Options
-ConfigFileThe NuGet configuration file to apply. If not specified,
%AppData%\NuGet\NuGet.Config(Windows), or~/.nuget/NuGet/NuGet.Configor~/.config/NuGet/NuGet.Config(Mac/Linux) is used.-ExpandAdds all the files in the package to the package source.
-ForceEnglishOutput(3.5+) Forces nuget.exe to run using an invariant, English-based culture. Forces nuget.exe to run using an invariant, English-based culture.
-?|-helpDisplays help information for the command.
-NonInteractiveSuppresses prompts for user input or confirmations.
-src|-SourceSpecifies the package source, which is a folder or UNC share, to which the nupkg will be added. Http sources are not supported.
-Verbosity [normal|quiet|detailed]Specifies the amount of detail displayed in the output:
normal(the default),quiet, ordetailed.
Also see Environment variables
Examples
nuget add foo.nupkg -Source c:\bar\
nuget add foo.nupkg -Source \\bar\packages\