diff --git a/docs/core/tools/dotnet-build.md b/docs/core/tools/dotnet-build.md index fd5cf84a41b18..b9d24be799e1d 100644 --- a/docs/core/tools/dotnet-build.md +++ b/docs/core/tools/dotnet-build.md @@ -3,7 +3,7 @@ title: dotnet build command - .NET Core CLI description: The dotnet build command builds a project and all of its dependencies. author: mairaw ms.author: mairaw -ms.date: 08/13/2017 +ms.date: 03/10/2018 ms.topic: article ms.prod: .net-core ms.technology: dotnet-cli @@ -22,12 +22,14 @@ ms.workload: # [.NET Core 2.x](#tab/netcore2x) ``` -dotnet build [] [-c|--configuration] [-f|--framework] [--force] [--no-dependencies] [--no-incremental] [--no-restore] [-o|--output] [-r|--runtime] [-v|--verbosity] [--version-suffix] +dotnet build [] [-c|--configuration] [-f|--framework] [--force] [--no-dependencies] [--no-incremental] + [--no-restore] [-o|--output] [-r|--runtime] [-v|--verbosity] [--version-suffix] dotnet build [-h|--help] ``` # [.NET Core 1.x](#tab/netcore1x) ``` -dotnet build [] [-c|--configuration] [-f|--framework] [--no-dependencies] [--no-incremental] [-o|--output] [-r|--runtime] [-v|--verbosity] [--version-suffix] +dotnet build [] [-c|--configuration] [-f|--framework] [--no-dependencies] [--no-incremental] [-o|--output] + [-r|--runtime] [-v|--verbosity] [--version-suffix] dotnet build [-h|--help] ``` --- @@ -40,7 +42,7 @@ If the project has third-party dependencies, such as libraries from NuGet, they' Building requires the *project.assets.json* file, which lists the dependencies of your application. The file is created when [`dotnet restore`](dotnet-restore.md) is executed. Without the assets file in place, the tooling cannot resolve reference assemblies, which results in errors. With .NET Core 1.x SDK, you needed to explicitily run the `dotnet restore` before running `dotnet build`. Starting with .NET Core 2.0 SDK, `dotnet restore` runs implicitily when you run `dotnet build`. If you want to disable implicit restore when running the build command, you can pass the `--no-restore` option. -[!INCLUDE[DotNet Restore Note](~/includes/dotnet-restore-note.md)] +[!INCLUDE[dotnet restore note + options](~/includes/dotnet-restore-note-options.md)] `dotnet build` uses MSBuild to build the project; thus, it supports both parallel and incremental builds. Refer to [Incremental Builds](/visualstudio/msbuild/incremental-builds) for more information. @@ -162,4 +164,8 @@ Build a project and its dependencies using Release configuration: Build a project and its dependencies for a specific runtime (in this example, Ubuntu 16.04): -`dotnet build --runtime ubuntu.16.04-x64` \ No newline at end of file +`dotnet build --runtime ubuntu.16.04-x64` + +Build the project and use the specified NuGet package source during the restore operation (.NET Core SDK 2.0 and later versions): + +`dotnet build --source c:\packages\mypackages` \ No newline at end of file diff --git a/docs/core/tools/dotnet-pack.md b/docs/core/tools/dotnet-pack.md index 83c5f4b991dde..a0e516cff34e6 100644 --- a/docs/core/tools/dotnet-pack.md +++ b/docs/core/tools/dotnet-pack.md @@ -3,7 +3,7 @@ title: dotnet pack command - .NET Core CLI description: The dotnet pack command creates NuGet packages for your .NET Core project. author: mairaw ms.author: mairaw -ms.date: 12/13/2017 +ms.date: 03/10/2018 ms.topic: article ms.prod: .net-core ms.technology: dotnet-cli @@ -23,7 +23,8 @@ ms.workload: # [.NET Core 2.x](#tab/netcore2x) ``` -dotnet pack [] [-c|--configuration] [--force] [--include-source] [--include-symbols] [--no-build] [--no-dependencies] [--no-restore] [-o|--output] [--runtime] [-s|--serviceable] [-v|--verbosity] [--version-suffix] +dotnet pack [] [-c|--configuration] [--force] [--include-source] [--include-symbols] [--no-build] [--no-dependencies] + [--no-restore] [-o|--output] [--runtime] [-s|--serviceable] [-v|--verbosity] [--version-suffix] dotnet pack [-h|--help] ``` @@ -44,6 +45,8 @@ By default, `dotnet pack` builds the project first. If you wish to avoid this be You can provide MSBuild properties to the `dotnet pack` command for the packing process. For more information, see [NuGet metadata properties](csproj.md#nuget-metadata-properties) and the [MSBuild Command-Line Reference](/visualstudio/msbuild/msbuild-command-line-reference). The [Examples](#examples) section shows how to use the MSBuild /p switch for a couple of different scenarios. +[!INCLUDE[dotnet restore note + options](~/includes/dotnet-restore-note-options.md)] + ## Arguments `PROJECT` @@ -154,7 +157,7 @@ Pack the project in the current directory: Pack the `app1` project: `dotnet pack ~/projects/app1/project.csproj` - + Pack the project in the current directory and place the resulting packages into the `nupkgs` folder: `dotnet pack --output nupkgs` @@ -174,3 +177,7 @@ Set the package version to `2.1.0` with the `PackageVersion` MSBuild property: Pack the project for a specific [target framework](../../standard/frameworks.md): `dotnet pack /p:TargetFrameworks=net45` + +Pack the project and use a specific runtime (Windows 10) for the restore operation (.NET Core SDK 2.0 and later versions): + +`dotnet pack --runtime win10-x64` \ No newline at end of file diff --git a/docs/core/tools/dotnet-publish.md b/docs/core/tools/dotnet-publish.md index 458c2398d7a56..f0d738b5cd213 100644 --- a/docs/core/tools/dotnet-publish.md +++ b/docs/core/tools/dotnet-publish.md @@ -3,7 +3,7 @@ title: dotnet publish command - .NET Core CLI description: The dotnet publish command publishes your .NET Core project into a directory. author: mairaw ms.author: mairaw -ms.date: 09/01/2017 +ms.date: 03/10/2018 ms.topic: article ms.prod: .net-core ms.technology: dotnet-cli @@ -47,6 +47,8 @@ dotnet publish [-h|--help] The `dotnet publish` command's output is ready for deployment to a hosting system (for example, a server, PC, Mac, laptop) for execution and is the only officially supported way to prepare the application for deployment. Depending on the type of deployment that the project specifies, the hosting system may or may not have the .NET Core shared runtime installed on it. For more information, see [.NET Core Application Deployment](../deploying/index.md). For the directory structure of a published application, see [Directory structure](/aspnet/core/hosting/directory-structure). +[!INCLUDE[dotnet restore note + options](~/includes/dotnet-restore-note-options.md)] + ## Arguments `PROJECT` @@ -152,16 +154,20 @@ Publish the project in the current directory: Publish the application using the specified project file: `dotnet publish ~/projects/app1/app1.csproj` - + Publish the project in the current directory using the `netcoreapp1.1` framework: `dotnet publish --framework netcoreapp1.1` - + Publish the current application using the `netcoreapp1.1` framework and the runtime for `OS X 10.10` (you must list this RID in the project file). `dotnet publish --framework netcoreapp1.1 --runtime osx.10.11-x64` +Publish the current application but don't restore project-to-project (P2P) references, just the root project during the restore operation (.NET Core SDK 2.0 and later versions): + +`dotnet publish --no-dependencies` + ## See also * [Target frameworks](../../standard/frameworks.md) -* [Runtime IDentifier (RID) catalog](../rid-catalog.md) +* [Runtime IDentifier (RID) catalog](../rid-catalog.md) \ No newline at end of file diff --git a/docs/core/tools/dotnet-restore.md b/docs/core/tools/dotnet-restore.md index 9bd3597d80054..5d72e8edc8fc6 100644 --- a/docs/core/tools/dotnet-restore.md +++ b/docs/core/tools/dotnet-restore.md @@ -114,7 +114,7 @@ Specifies a runtime for the package restore. This is used to restore packages fo `-s|--source ` -Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the *NuGet.config* file(s). Multiple sources can be provided by specifying this option multiple times. +Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the *NuGet.config* files. Multiple sources can be provided by specifying this option multiple times. `--verbosity ` @@ -156,7 +156,7 @@ Specifies a runtime for the package restore. This is used to restore packages fo `-s|--source ` -Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the *NuGet.config* file(s). Multiple sources can be provided by specifying this option multiple times. +Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the *NuGet.config* files. Multiple sources can be provided by specifying this option multiple times. `--verbosity ` diff --git a/docs/core/tools/dotnet-run.md b/docs/core/tools/dotnet-run.md index c6f5c0ac732d2..beb2351ed1c48 100644 --- a/docs/core/tools/dotnet-run.md +++ b/docs/core/tools/dotnet-run.md @@ -3,7 +3,7 @@ title: dotnet run command - .NET Core CLI description: The dotnet run command provides a convenient option to run your application from the source code. author: mairaw ms.author: mairaw -ms.date: 09/24/2017 +ms.date: 03/10/2018 ms.topic: article ms.prod: .net-core ms.technology: dotnet-cli @@ -38,9 +38,9 @@ dotnet run [-h|--help] ## Description -The `dotnet run` command provides a convenient option to run your application from the source code with one command. It's useful for fast iterative development from the command line. The command depends on the [`dotnet build`](dotnet-build.md) command to build the code. Any requirements for the build, such as that the project must be restored first, apply to `dotnet run` as well. +The `dotnet run` command provides a convenient option to run your application from the source code with one command. It's useful for fast iterative development from the command line. The command depends on the [`dotnet build`](dotnet-build.md) command to build the code. Any requirements for the build, such as that the project must be restored first, apply to `dotnet run` as well. -Output files are written into the default location, which is `bin//`. For example if you have a `netcoreapp1.0` application and you run `dotnet run`, the output is placed in `bin/Debug/netcoreapp1.0`. Files are overwritten as needed. Temporary files are placed in the `obj` directory. +Output files are written into the default location, which is `bin//`. For example if you have a `netcoreapp1.0` application and you run `dotnet run`, the output is placed in `bin/Debug/netcoreapp1.0`. Files are overwritten as needed. Temporary files are placed in the `obj` directory. If the project specifies multiple frameworks, executing `dotnet run` results in an error unless the `-f|--framework ` option is used to specify the framework. @@ -54,6 +54,8 @@ For more information on the `dotnet` driver, see the [.NET Core Command Line Too In order to run the application, the `dotnet run` command resolves the dependencies of the application that are outside of the shared runtime from the NuGet cache. Because it uses cached dependencies, it's not recommended to use `dotnet run` to run applications in production. Instead, [create a deployment](../deploying/index.md) using the [`dotnet publish`](dotnet-publish.md) command and deploy the published output. +[!INCLUDE[dotnet restore note + options](~/includes/dotnet-restore-note-options.md)] + ## Options # [.NET Core 2.x](#tab/netcore2x) @@ -130,7 +132,7 @@ Prints out a short help for the command. Specifies the path and name of the project file. (See the NOTE.) It defaults to the current directory if not specified. > [!NOTE] -> Use the path and name of the project file with the `-p|--project` option. A regression in the CLI prevents providing a folder path with .NET Core 1.x SDK. For more information about this issue, see [dotnet run -p, can not start a project (dotnet/cli #5992)](https://github.com/dotnet/cli/issues/5992). +> Use the path and name of the project file with the `-p|--project` option. A regression in the CLI prevents providing a folder path with .NET Core SDK 1.x. For more information about this issue, see [dotnet run -p, can not start a project (dotnet/cli #5992)](https://github.com/dotnet/cli/issues/5992). --- @@ -147,3 +149,8 @@ Run the specified project: Run the project in the current directory (the `--help` argument in this example is passed to the application, since the `--` argument is used): `dotnet run --configuration Release -- --help` + +Restore dependencies and tools for the project in the current directory only showing minimal output and then run the project: + (.NET Core SDK 2.0 and later versions): + +`dotnet run --verbosity m` \ No newline at end of file diff --git a/includes/dotnet-restore-note-options.md b/includes/dotnet-restore-note-options.md new file mode 100644 index 0000000000000..9419ce4c146c8 --- /dev/null +++ b/includes/dotnet-restore-note-options.md @@ -0,0 +1,4 @@ +> [!NOTE] +> Starting with .NET Core 2.0, you don't have to run [`dotnet restore`](~/docs/core/tools/dotnet-restore.md) because it's run implicitly by all commands, such as `dotnet build` and `dotnet run`, that require a restore to occur. It's still a valid command in certain scenarios where doing an explicit restore makes sense, such as [continuous integration builds in Visual Studio Team Services](/vsts/build-release/apps/aspnet/build-aspnet-core) or in build systems that need to explicitly control the time at which the restore occurs. +> +> This command also supports the `dotnet restore` options when passed in the long form (for example, `--source`). Short form options, such as `-s`, are not supported. \ No newline at end of file