. NET Core CLI Tools Documentation Dotnet-pack

Source: Internet
Author: User
Tags dotnet

Name

Dotnet-pack-Package code as a NuGet package

Profile

' dotnet pack [--output]

[--no-build] [--build-base-path] [--configuration] [--version-suffix] [<project>] '

Describe

The dotnet Pack command builds the project and creates a NuGet package. The result of this operation is a package of two nupkg extensions. One contains the code and the other contains the debug symbol.

The project is dependent on the NuGet wrapper that is added to the Nuspec file, so they can be resolved when the package is installed.
By default, project-to-project references are not packaged into projects. If you want to do that, you need to refer to the type node in your dependencies that requires the project to be set to "build", as in the following example:

{    "version": "1.0.0-*",    "dependencies": {        "projecta": {            "target": "Project",            "type": "Build"        }    }}

By default, the Dotnet pack first builds the project. If you want to avoid this, pass the--no-build option. This is useful in the continuous integration (CI) build scenario, as you know that the code is just a pre-built example.

Options

[Project]

Packaged items. It can also be a path to a Project.json file or a directory. If omitted, it defaults to the current directory.

-O,--output [DIR]

Specifies the generated directory.

--no-build

Skip the build phase in the packaging process.

--build-base-path

Specifies the catalog of temporary build artifacts. By default, they are in the obj directory of the current directory.

-C,--configuration [debug| Release]

The configuration that is used when the project is built. If not specified, the default is "Debug".

Example

Dotnet Pack

Package the current project.

Dotnet Pack ~/projects/app1/project.json

Package The APP1 project.

dotnet Pack--output nupkgs

Packages the current application and places the resulting package in the specified folder.

dotnet Pack--no-build--output nupkgs

Packages the current project into the specified folder, and skips the build step.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.