Home  >  Article  >  Backend Development  >  .NET Core CLI tool documentation dotnet-pack

.NET Core CLI tool documentation dotnet-pack

高洛峰
高洛峰Original
2016-11-21 16:32:231604browse

Name

dotnet-pack - Pack code into a NuGet package

Summary

`dotnet pack [--output]

[--no-build] [--build-base-path] [--configuration] [--version-suffix][c70346ba2d7be186a93fef826469bd2f]`

Description

dotnet pack command generates a project and creates a NuGet package. The result of this operation is two packages with nupkg extension. One contains code and the other contains debugging symbols.

The NuGet packages that the project depends on are added to the nuspec file, so they can be resolved when installing the package.
By default, project-to-project references are not packaged into the project. If you want to do that, you need to reference in your dependencies the type node of the project that needs to be set to "build", set up like the following example:

{
    "version": "1.0.0-*",
    "dependencies": {
        "ProjectA": {
            "target": "project",
            "type": "build"
        }
    }
}

By default, dotnet pack builds the project first. If you want to avoid this, pass the --no-build option. This can be useful in continuous integration (CI) build scenarios where you know the code is just a pre-generated example.

Options

[project]

Packaged project. It can also be a path to a project.json file or a directory. If omitted, it will default to the current directory.

-o, --output [DIR]

Specify the generated directory.

--no-build

Skip the build phase during the packaging process.

--build-base-path

Specifies the directory for temporary generation of products. By default, they are in the obj directory of the current directory.

-c, --configuration [Debug|Release]

The configuration used when generating the project. If not specified, it will default to "Debug".

Example

dotnet pack

Pack the current project.

dotnet pack ~/projects/app1/project.json

Pack the app1 project.

dotnet pack --output nupkgs

Pack the current application and place the generated package into the specified folder.

dotnet pack --no-build --output nupkgs

Pack the current project into the specified folder and skip the generation step.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn