diff --git a/docfx.json b/docfx.json index 9d5ee8ed87039..5a4bc914e7e25 100644 --- a/docfx.json +++ b/docfx.json @@ -366,7 +366,7 @@ "docs/core/runtime-config/**/**.md": "gewarren", "docs/core/testing/**/**.md": "IEvangelist", "docs/core/tools/**/**.md": "adegeo", - "docs/core/tutorials/**/**.md": "billwagner", + "docs/core/tutorials/**/**.md": "meaghanlewis", "docs/core/versions/**/**.md": "billwagner", "docs/core/whats-new/**/**.md": "gewarren", "docs/csharp/**/*.*": "billwagner", @@ -459,7 +459,7 @@ "docs/core/runtime-config/**/**.md": "gewarren", "docs/core/testing/**/**.md": "dapine", "docs/core/tools/**/**.md": "adegeo", - "docs/core/tutorials/**/**.md": "wiwagn", + "docs/core/tutorials/**/**.md": "mosagie", "docs/core/versions/**/**.md": "wiwagn", "docs/core/whats-new/**/**.md": "gewarren", "docs/csharp/**/*.*": "wiwagn", diff --git a/docs/ai/microsoft-extensions-ai.md b/docs/ai/microsoft-extensions-ai.md index e3eff2c3e3bf4..f3eb7adf0da24 100644 --- a/docs/ai/microsoft-extensions-ai.md +++ b/docs/ai/microsoft-extensions-ai.md @@ -100,6 +100,8 @@ The preceding code: - Calls `GetStreamingResponseAsync` on the client, passing a prompt and a list of tools that includes a function created with . - Iterates over the response, printing each update to the console. +You can also use Model Context Protocol (MCP) tools with your `IChatClient`. For more information, see [Build a minimal MCP client](./quickstarts/build-mcp-client.md). + #### Cache responses If you're familiar with [Caching in .NET](../core/extensions/caching.md), it's good to know that provides other such delegating `IChatClient` implementations. The is an `IChatClient` that layers caching around another arbitrary `IChatClient` instance. When a novel chat history is submitted to the `DistributedCachingChatClient`, it forwards it to the underlying client and then caches the response before sending it back to the consumer. The next time the same history is submitted, such that a cached response can be found in the cache, the `DistributedCachingChatClient` returns the cached response rather than forwarding the request along the pipeline. diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index 29d7b8fc38b2b..635acb5d9e2a4 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -368,7 +368,7 @@ | Resource Management - SQL | NuGet [1.3.0](https://www.nuget.org/packages/Azure.ResourceManager.Sql/1.3.0)
NuGet [1.4.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.Sql/1.4.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.Sql-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Sql_1.3.0/sdk/sqlmanagement/Azure.ResourceManager.Sql/)
GitHub [1.4.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Sql_1.4.0-beta.3/sdk/sqlmanagement/Azure.ResourceManager.Sql/) | | Resource Management - SQL Virtual Machine | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.SqlVirtualMachine/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.SqlVirtualMachine-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.SqlVirtualMachine_1.1.1/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/) | | Resource Management - Standby Pool | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.StandbyPool/1.1.0) | [docs](/dotnet/api/overview/azure/ResourceManager.StandbyPool-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.StandbyPool_1.1.0/sdk/standbypool/Azure.ResourceManager.StandbyPool/) | -| Resource Management - Storage | NuGet [1.4.4](https://www.nuget.org/packages/Azure.ResourceManager.Storage/1.4.4) | [docs](/dotnet/api/overview/azure/ResourceManager.Storage-readme) | GitHub [1.4.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Storage_1.4.4/sdk/storage/Azure.ResourceManager.Storage/) | +| Resource Management - Storage | NuGet [1.5.0](https://www.nuget.org/packages/Azure.ResourceManager.Storage/1.5.0) | [docs](/dotnet/api/overview/azure/ResourceManager.Storage-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Storage_1.5.0/sdk/storage/Azure.ResourceManager.Storage/) | | Resource Management - Storage Actions | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.StorageActions/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.StorageActions-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.StorageActions_1.0.0/sdk/storageactions/Azure.ResourceManager.StorageActions/) | | Resource Management - Storage Cache | NuGet [1.3.2](https://www.nuget.org/packages/Azure.ResourceManager.StorageCache/1.3.2) | [docs](/dotnet/api/overview/azure/ResourceManager.StorageCache-readme) | GitHub [1.3.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.StorageCache_1.3.2/sdk/storagecache/Azure.ResourceManager.StorageCache/) | | Resource Management - Storage Mover | NuGet [1.2.1](https://www.nuget.org/packages/Azure.ResourceManager.StorageMover/1.2.1) | [docs](/dotnet/api/overview/azure/ResourceManager.StorageMover-readme) | GitHub [1.2.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.StorageMover_1.2.1/sdk/storagemover/Azure.ResourceManager.StorageMover/) | @@ -405,8 +405,8 @@ | IoT Operations MQTT | NuGet [0.11.0](https://www.nuget.org/packages/Azure.Iot.Operations.Mqtt/0.11.0) | | | | IoT Operations Protocol | NuGet [0.12.1](https://www.nuget.org/packages/Azure.Iot.Operations.Protocol/0.12.1) | | | | IoT Operations Services | NuGet [0.14.0](https://www.nuget.org/packages/Azure.Iot.Operations.Services/0.14.0) | | | -| Item Templates NetCore | NuGet [4.0.5212](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates.NetCore/4.0.5212) | | | -| Item Templates NetFx | NuGet [4.0.5212](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates.NetFx/4.0.5212) | | | +| Item Templates NetCore | NuGet [4.0.5267](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates.NetCore/4.0.5267) | | | +| Item Templates NetFx | NuGet [4.0.5267](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates.NetFx/4.0.5267) | | | | Microsoft.Azure.DataFactoryTestingFramework.Expressions | NuGet [0.2.7](https://www.nuget.org/packages/Microsoft.Azure.DataFactoryTestingFramework.Expressions/0.2.7) | | | | Microsoft.Azure.Functions.Worker.OpenTelemetry | NuGet [1.1.0-preview6](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.OpenTelemetry/1.1.0-preview6) | | | | OpenTelemetry Profiler | NuGet [1.0.0-beta5](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.Profiler/1.0.0-beta5) | | | @@ -523,7 +523,7 @@ | App Service - API Apps Service | NuGet [0.9.64](https://www.nuget.org/packages/Microsoft.Azure.AppService.ApiApps.Service/0.9.64) | | | | Code Analyzers for Durable Functions | NuGet [0.5.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers/0.5.0) | | GitHub [0.5.0](https://github.com/Azure/azure-functions-durable-extension/tree/Analyzer-v0.3.0/src/WebJobs.Extensions.DurableTask.Analyzers) | | Cosmos DB - BulkExecutor | NuGet [2.5.1-preview](https://www.nuget.org/packages/Microsoft.Azure.CosmosDB.BulkExecutor/2.5.1-preview) | | GitHub [2.5.1-preview](https://github.com/Azure/azure-cosmosdb-bulkexecutor-dotnet-getting-started) | -| Cosmos DB - Direct | NuGet [3.40.3](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Direct/3.40.3) | | GitHub [3.40.3](https://github.com/Azure/azure-cosmos-dotnet-v3) | +| Cosmos DB - Direct | NuGet [3.41.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Direct/3.41.0) | | GitHub [3.41.0](https://github.com/Azure/azure-cosmos-dotnet-v3) | | Cosmos DB - Encryption | NuGet [2.0.3](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/2.0.3)
NuGet [2.1.0-preview4](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/2.1.0-preview4) | | GitHub [2.0.3](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/releases/encryption/1.0.0-preview4/Microsoft.Azure.Cosmos.Encryption) | | Cosmos DB - Encryption | NuGet [1.0.0-preview07](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption.Custom/1.0.0-preview07) | | | | Extensions - Caching Cosmos | NuGet [1.8.0](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Cosmos/1.8.0) | | GitHub [1.8.0](https://github.com/Azure/Microsoft.Extensions.Caching.Cosmos/tree/v1.0.0-preview4) | @@ -553,10 +553,10 @@ | Functions Extensions - Redis | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Redis/1.0.0) | | | | Functions Extensions - Redis | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Redis/1.0.0) | | | | Functions Extensions - Worker Extentions | NuGet [1.0.1](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Dapr/1.0.1) | | | -| Functions item template pack for Microsoft Template Engine | NuGet [4.0.5212](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ItemTemplates/4.0.5212) | | GitHub [4.0.5212](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) | +| Functions item template pack for Microsoft Template Engine | NuGet [4.0.5267](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ItemTemplates/4.0.5267) | | GitHub [4.0.5267](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) | | Functions OpenAPI app settings deserialization library | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings/1.4.0)
NuGet [2.0.0-preview2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings/2.0.0-preview2) | | | | Functions OpenAPI document and Swagger UI renderer library | NuGet [1.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/1.4.0)
NuGet [2.0.0-preview2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/2.0.0-preview2) | | | -| Functions project template pack for Microsoft Template Engine | NuGet [4.0.5212](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ProjectTemplates/4.0.5212) | | GitHub [4.0.5212](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) | +| Functions project template pack for Microsoft Template Engine | NuGet [4.0.5267](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.ProjectTemplates/4.0.5267) | | GitHub [4.0.5267](https://github.com/Azure/azure-functions-templates/tree/3.1.1582) | | Functions runtime assemblies for App Insights logging | NuGet [3.0.41](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/3.0.41) | | GitHub [3.0.41](https://github.com/Azure/azure-webjobs-sdk/tree/v3.0.18/src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights) | | Functions runtime assemblies for logging | NuGet [4.0.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Logging/4.0.3) | | | | Functions runtime assemblies for Microsoft.Azure.WebJobs.Host | NuGet [3.0.42](https://www.nuget.org/packages/Microsoft.Azure.WebJobs/3.0.42) | | GitHub [3.0.42](https://github.com/Azure/azure-webjobs-sdk/tree/v3.0.18/src/Microsoft.Azure.WebJobs) | @@ -590,8 +590,8 @@ | Microsoft.Azure.Functions.Worker.Extensions.Timer | NuGet [4.3.1](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Timer/4.3.1) | | | | Microsoft.Azure.Functions.Worker.Extensions.Warmup | NuGet [4.0.2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.Warmup/4.0.2) | | | | Microsoft.Azure.Functions.Worker.Grpc | NuGet [2.0.0](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Grpc/2.0.0)
NuGet [2.50.0-preview1](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Grpc/2.50.0-preview1) | | | -| Microsoft.Azure.Functions.Worker.ItemTemplates | NuGet [4.0.5212](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates/4.0.5212) | | | -| Microsoft.Azure.Functions.Worker.ProjectTemplates | NuGet [4.0.5212](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ProjectTemplates/4.0.5212) | | | +| Microsoft.Azure.Functions.Worker.ItemTemplates | NuGet [4.0.5267](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ItemTemplates/4.0.5267) | | | +| Microsoft.Azure.Functions.Worker.ProjectTemplates | NuGet [4.0.5267](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.ProjectTemplates/4.0.5267) | | | | Microsoft.Azure.Functions.Worker.Sdk | NuGet [2.0.5](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk/2.0.5) | | | | Microsoft.Azure.Functions.Worker.Sdk.Analyzers | NuGet [1.2.2](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk.Analyzers/1.2.2) | | | | Microsoft.Azure.Functions.Worker.Sdk.Generators | NuGet [1.3.5](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Sdk.Generators/1.3.5) | | | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index 8729b2a6f8b12..18f7b6ad78942 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -382,7 +382,7 @@ | Resource Management - SQL | NuGet [1.3.0](https://www.nuget.org/packages/Azure.ResourceManager.Sql/1.3.0)
NuGet [1.4.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.Sql/1.4.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.Sql-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Sql_1.3.0/sdk/sqlmanagement/Azure.ResourceManager.Sql/)
GitHub [1.4.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Sql_1.4.0-beta.3/sdk/sqlmanagement/Azure.ResourceManager.Sql/) | | Resource Management - SQL Virtual Machine | NuGet [1.1.1](https://www.nuget.org/packages/Azure.ResourceManager.SqlVirtualMachine/1.1.1) | [docs](/dotnet/api/overview/azure/ResourceManager.SqlVirtualMachine-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.SqlVirtualMachine_1.1.1/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/) | | Resource Management - Standby Pool | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.StandbyPool/1.1.0) | [docs](/dotnet/api/overview/azure/ResourceManager.StandbyPool-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.StandbyPool_1.1.0/sdk/standbypool/Azure.ResourceManager.StandbyPool/) | -| Resource Management - Storage | NuGet [1.4.4](https://www.nuget.org/packages/Azure.ResourceManager.Storage/1.4.4) | [docs](/dotnet/api/overview/azure/ResourceManager.Storage-readme) | GitHub [1.4.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Storage_1.4.4/sdk/storage/Azure.ResourceManager.Storage/) | +| Resource Management - Storage | NuGet [1.5.0](https://www.nuget.org/packages/Azure.ResourceManager.Storage/1.5.0) | [docs](/dotnet/api/overview/azure/ResourceManager.Storage-readme) | GitHub [1.5.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Storage_1.5.0/sdk/storage/Azure.ResourceManager.Storage/) | | Resource Management - Storage Actions | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.StorageActions/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.StorageActions-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.StorageActions_1.0.0/sdk/storageactions/Azure.ResourceManager.StorageActions/) | | Resource Management - Storage Cache | NuGet [1.3.2](https://www.nuget.org/packages/Azure.ResourceManager.StorageCache/1.3.2) | [docs](/dotnet/api/overview/azure/ResourceManager.StorageCache-readme) | GitHub [1.3.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.StorageCache_1.3.2/sdk/storagecache/Azure.ResourceManager.StorageCache/) | | Resource Management - Storage Mover | NuGet [1.2.1](https://www.nuget.org/packages/Azure.ResourceManager.StorageMover/1.2.1) | [docs](/dotnet/api/overview/azure/ResourceManager.StorageMover-readme) | GitHub [1.2.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.StorageMover_1.2.1/sdk/storagemover/Azure.ResourceManager.StorageMover/) | diff --git a/docs/azure/media/appmod-dotnet-containerization-tool-selection.png b/docs/azure/media/appmod-dotnet-containerization-tool-selection.png new file mode 100644 index 0000000000000..0ba0dde168f91 Binary files /dev/null and b/docs/azure/media/appmod-dotnet-containerization-tool-selection.png differ diff --git a/docs/azure/migration/appmod/containerization.md b/docs/azure/migration/appmod/containerization.md index 6ae086ad208d6..a312fddb46f11 100644 --- a/docs/azure/migration/appmod/containerization.md +++ b/docs/azure/migration/appmod/containerization.md @@ -30,6 +30,10 @@ The GitHub Copilot app modernization for .NET containerization feature helps you 1. Open your project in Visual Studio. +1. Enable **appModernizationDeploy** in the GitHub Copilot toolbox. + + :::image type="content" source="../../media/appmod-dotnet-containerization-tool-selection.png" alt-text="Screenshot that shows containerization tool selection."::: + 1. Start containerization by using one of these approaches: - **Containerize from Assessment Report**: In the assessment report, select **Run Task** for the Docker Containerization issue. diff --git a/docs/core/tools/dotnet-build.md b/docs/core/tools/dotnet-build.md index bbd05214f6a38..d4ac620eb2725 100644 --- a/docs/core/tools/dotnet-build.md +++ b/docs/core/tools/dotnet-build.md @@ -1,20 +1,20 @@ --- title: dotnet build command description: The dotnet build command builds a project and all of its dependencies. -ms.date: 11/27/2023 +ms.date: 09/24/2025 --- # dotnet build -**This article applies to:** ✔️ .NET Core 3.1 SDK and later versions +**This article applies to:** ✔️ .NET 6 and later versions ## Name -`dotnet build` - Builds a project and all of its dependencies. +`dotnet build` - Builds a project, solution, or file-based app and all of its dependencies. ## Synopsis ```dotnetcli -dotnet build [|] [-a|--arch ] +dotnet build [||] [-a|--arch ] [--artifacts-path ] [-c|--configuration ] [-f|--framework ] [--disable-build-servers] @@ -23,7 +23,7 @@ dotnet build [|] [-a|--arch ] [-o|--output ] [-p|--property:=] [-r|--runtime ] - [--self-contained [true|false]] [--source ] + [-sc|--self-contained [true|false]] [--source ] [--tl:[auto|on|off]] [--use-current-runtime, --ucr [true|false]] [-v|--verbosity ] [--version-suffix ] @@ -32,16 +32,14 @@ dotnet build -h|--help ## Description -The `dotnet build` command builds the project and its dependencies into a set of binaries. The binaries include the project's code in Intermediate Language (IL) files with a *.dll* extension. Depending on the project type and settings, other files may be included, such as: +The `dotnet build` command builds the project, solution, or file-based app and its dependencies into a set of binaries. The binaries include the project's code in Intermediate Language (IL) files with a *.dll* extension. Depending on the project type and settings, other files may be included, such as: -- An executable that can be used to run the application, if the project type is an executable targeting .NET Core 3.0 or later. +- An executable that can be used to run the application. - Symbol files used for debugging with a *.pdb* extension. - A *.deps.json* file, which lists the dependencies of the application or library. - A *.runtimeconfig.json* file, which specifies the shared runtime and its version for an application. - Other libraries that the project depends on (via project references or NuGet package references). -For executable projects targeting versions earlier than .NET Core 3.0, library dependencies from NuGet are typically NOT copied to the output folder. They're resolved from the NuGet global packages folder at run time. With that in mind, the product of `dotnet build` isn't ready to be transferred to another machine to run. To create a version of the application that can be deployed, you need to publish it (for example, with the [dotnet publish](dotnet-publish.md) command). For more information, see [.NET Application Deployment](../deploying/index.md). - For executable projects targeting .NET Core 3.0 and later, library dependencies are copied to the output folder. This means that if there isn't any other publish-specific logic (such as Web projects have), the build output should be deployable. ### Implicit restore @@ -64,7 +62,7 @@ To produce a library, omit the `` property or change its value to `L ### MSBuild -`dotnet build` uses MSBuild to build the project, so it supports both parallel and incremental builds. For more information, see [Incremental Builds](/visualstudio/msbuild/incremental-builds). +`dotnet build` uses MSBuild to build the project, solution, or file-based app. It supports both parallel and incremental builds. For more information, see [Incremental Builds](/visualstudio/msbuild/incremental-builds). In addition to its options, the `dotnet build` command accepts MSBuild options, such as `-p` for setting properties or `-l` to define a logger. For more information about these options, see the [MSBuild Command-Line Reference](/visualstudio/msbuild/msbuild-command-line-reference). Or you can also use the [dotnet msbuild](dotnet-msbuild.md) command. @@ -77,9 +75,7 @@ Running `dotnet build` is equivalent to running `dotnet msbuild -restore`; howev ## Arguments -`PROJECT | SOLUTION` - -The project or solution file to build. If a project or solution file isn't specified, MSBuild searches the current working directory for a file that has a file extension that ends in either *proj* or *sln* and uses that file. +[!INCLUDE [arguments-project-solution-file](../../../includes/cli-arguments-project-solution-file.md)] ## Options @@ -176,6 +172,14 @@ The project or solution file to build. If a project or solution file isn't speci dotnet build ``` +- Build a file-based app: + + ```dotnetcli + dotnet build MyProject.cs + ``` + + File-based app support was added in .NET SDK 10.0.100. + - Build a project and its dependencies using Release configuration: ```dotnetcli diff --git a/docs/core/tools/dotnet-clean.md b/docs/core/tools/dotnet-clean.md index 912e73e70ab15..b2c8104351c73 100644 --- a/docs/core/tools/dotnet-clean.md +++ b/docs/core/tools/dotnet-clean.md @@ -1,11 +1,11 @@ --- title: dotnet clean command description: The dotnet clean command cleans the current directory. -ms.date: 02/14/2020 +ms.date: 09/24/2025 --- # dotnet clean -**This article applies to:** ✔️ .NET Core 3.1 SDK and later versions +**This article applies to:** ✔️ .NET 6 and later versions ## Name @@ -14,7 +14,7 @@ ms.date: 02/14/2020 ## Synopsis ```dotnetcli -dotnet clean [|] [--artifacts-path ] +dotnet clean [||] [--artifacts-path ] [-c|--configuration ] [-f|--framework ] [--interactive] [--nologo] [-o|--output ] @@ -30,9 +30,7 @@ The `dotnet clean` command cleans the output of the previous build. It's impleme ## Arguments -`PROJECT | SOLUTION` - -The MSBuild project or solution to clean. If a project or solution file is not specified, MSBuild searches the current working directory for a file that has a file extension that ends in *proj* or *sln*, and uses that file. +[!INCLUDE [arguments-project-solution-file](../../../includes/cli-arguments-project-solution-file.md)] ## Options @@ -40,7 +38,7 @@ The MSBuild project or solution to clean. If a project or solution file is not s [!INCLUDE [configuration](../../../includes/cli-configuration-clean.md)] -* **`-f|--framework `** +- **`-f|--framework `** The [framework](../../standard/frameworks.md) that was specified at build time. The framework must be defined in the [project file](../project-sdk/overview.md). If you specified the framework at build time, you must specify the framework when cleaning. @@ -48,11 +46,11 @@ The MSBuild project or solution to clean. If a project or solution file is not s [!INCLUDE [interactive](../../../includes/cli-interactive-3-0.md)] -* **`--nologo`** +- **`--nologo`** Doesn't display the startup banner or the copyright message. -* **`-o|--output `** +- **`-o|--output `** The directory that contains the build artifacts to clean. Specify the `-f|--framework ` switch with the output directory switch if you specified the framework when the project was built. @@ -60,7 +58,7 @@ The MSBuild project or solution to clean. If a project or solution file is not s If you specify the `--output` option when running this command on a solution, the CLI will emit a warning (an error in 7.0.200) due to the unclear semantics of the output path. The `--output` option is disallowed because all outputs of all built projects would be copied into the specified directory, which isn't compatible with multi-targeted projects, as well as projects that have different versions of direct and transitive dependencies. For more information, see [Solution-level `--output` option no longer valid for build-related commands](../compatibility/sdk/7.0/solution-level-output-no-longer-valid.md). -* **`-r|--runtime `** +- **`-r|--runtime `** Cleans the output folder of the specified runtime. This is used when a [self-contained deployment](../deploying/index.md#self-contained-deployment) was created. @@ -70,13 +68,21 @@ The MSBuild project or solution to clean. If a project or solution file is not s ## Examples -* Clean a default build of the project: +- Clean a default build of the project: ```dotnetcli dotnet clean ``` -* Clean a project built using the Release configuration: +- Clean a file-based program: + + ```dotnetcli + dotnet clean Program.cs. + ``` + + File-based app support was added in .NET SDK 10.0.100. + +- Clean a project built using the Release configuration: ```dotnetcli dotnet clean --configuration Release diff --git a/docs/core/tools/dotnet-publish.md b/docs/core/tools/dotnet-publish.md index 94ffde8e5747a..c15c7205b6b47 100644 --- a/docs/core/tools/dotnet-publish.md +++ b/docs/core/tools/dotnet-publish.md @@ -1,11 +1,11 @@ --- title: dotnet publish command description: The dotnet publish command publishes a .NET project or solution to a directory. -ms.date: 01/07/2025 +ms.date: 09/24/2025 --- # dotnet publish -**This article applies to:** ✔️ .NET Core 3.1 SDK and later versions +**This article applies to:** ✔️ .NET 6 and later versions ## Name @@ -14,7 +14,7 @@ ms.date: 01/07/2025 ## Synopsis ```dotnetcli -dotnet publish [|] [-a|--arch ] +dotnet publish [||] [-a|--arch ] [--artifacts-path ] [-c|--configuration ] [--disable-build-servers] [-f|--framework ] [--force] [--interactive] @@ -114,13 +114,7 @@ For more information, see the following resources: ## Arguments -- **`PROJECT|SOLUTION`** - - The project or solution to publish. - - * `PROJECT` is the path and filename of a C#, F#, or Visual Basic project file, or the path to a directory that contains a C#, F#, or Visual Basic project file. If the directory is not specified, it defaults to the current directory. - - * `SOLUTION` is the path and filename of a solution file (*.sln* or *.slnx* extension), or the path to a directory that contains a solution file. If the directory is not specified, it defaults to the current directory. +[!INCLUDE [arguments-project-solution-file](../../../includes/cli-arguments-project-solution-file.md)] ## Options @@ -186,12 +180,6 @@ For more information, see the following resources: If you specify a relative path when publishing a solution, all output for all projects goes into the specified folder relative to the current working directory. To make publish output go to separate folders for each project, specify a relative path by using the msbuild `PublishDir` property instead of the `--output` option. For example, `dotnet publish -p:PublishDir=.\publish` sends publish output for each project to a `publish` folder under the folder that contains the project file. - - .NET Core 2.x SDK - - If you specify a relative path when publishing a project, the generated output directory is relative to the project file location, not to the current working directory. - - If you specify a relative path when publishing a solution, each project's output goes into a separate folder relative to the project file location. If you specify an absolute path when publishing a solution, all publish output for all projects goes into the specified folder. - [!INCLUDE [os](../../../includes/cli-os.md)] - **`--sc|--self-contained [true|false]`** @@ -268,6 +256,14 @@ For more information, see the following resources: dotnet publish --no-dependencies ``` +- Publish the file-based C# program *app.cs* in the current directory: + + ```dotnetcli + dotnet publish app.cs + ``` + + File-based program support was added in .NET SDK 10.0.100. + ## See also - [.NET application publishing overview](../deploying/index.md) diff --git a/docs/core/tools/dotnet-restore.md b/docs/core/tools/dotnet-restore.md index 260800790a7f6..2ca8374b29b70 100644 --- a/docs/core/tools/dotnet-restore.md +++ b/docs/core/tools/dotnet-restore.md @@ -1,11 +1,11 @@ --- title: dotnet restore command description: Learn how to restore dependencies and project-specific tools with the dotnet restore command. -ms.date: 07/19/2023 +ms.date: 09/24/2025 --- # dotnet restore -**This article applies to:** ✔️ .NET Core 3.1 SDK and later versions +**This article applies to:** ✔️ .NET 6 and later versions ## Name @@ -14,7 +14,7 @@ ms.date: 07/19/2023 ## Synopsis ```dotnetcli -dotnet restore [] [--configfile ] [--disable-build-servers] +dotnet restore [||] [--configfile ] [--disable-build-servers] [--disable-parallel] [-f|--force] [--force-evaluate] [--ignore-failed-sources] [--interactive] [--lock-file-path ] [--locked-mode] @@ -86,9 +86,7 @@ There are three specific settings that `dotnet restore` ignores: ## Arguments -- **`ROOT`** - - Optional path to the project file to restore. +[!INCLUDE [arguments-project-solution-file](../../../includes/cli-arguments-project-solution-file.md)] ## Options @@ -184,19 +182,19 @@ There are three specific settings that `dotnet restore` ignores: dotnet restore ./projects/app1/app1.csproj ``` -- Restore the dependencies and tools for the project in the current directory using the file path provided as the source: +- Restore the dependencies and tools for the project in the current directory using the file path provided as the source: ```dotnetcli dotnet restore -s c:\packages\mypackages ``` -- Restore the dependencies and tools for the project in the current directory using the two file paths provided as sources: +- Restore the dependencies and tools for the project in the current directory using the two file paths provided as sources: ```dotnetcli dotnet restore -s c:\packages\mypackages -s c:\packages\myotherpackages ``` -- Restore dependencies and tools for the project in the current directory showing detailed output: +- Restore dependencies and tools for the project in the current directory showing detailed output: ```dotnetcli dotnet restore --verbosity detailed diff --git a/docs/core/tools/dotnet-run.md b/docs/core/tools/dotnet-run.md index 120c3c285e564..52d837939bb34 100644 --- a/docs/core/tools/dotnet-run.md +++ b/docs/core/tools/dotnet-run.md @@ -1,11 +1,11 @@ --- title: dotnet run command description: The dotnet run command provides a convenient option to run your application from the source code. -ms.date: 03/26/2025 +ms.date: 09/24/2025 --- # dotnet run -**This article applies to:** ✔️ .NET Core 3.1 SDK and later versions +**This article applies to:** ✔️ .NET 6 and later versions ## Name @@ -14,8 +14,8 @@ ms.date: 03/26/2025 ## Synopsis ```dotnetcli -dotnet run [-a|--arch ] [-c|--configuration ] - [-e|--environment ] +dotnet run [] [-a|--arch ] [-c|--configuration ] + [-e|--environment ] [--file ] [-f|--framework ] [--force] [--interactive] [--launch-profile ] [--no-build] [--no-dependencies] [--no-launch-profile] [--no-restore] @@ -53,6 +53,14 @@ To run the application, the `dotnet run` command resolves the dependencies of th [!INCLUDE [cli-advertising-manifests](../../../includes/cli-advertising-manifests.md)] +## Arguments + + `` + + Arguments passed to the application that is being run. + + Any arguments that aren't recognized by `dotnet run` are passed to the application. To separate arguments for `dotnet run` from arguments for the application, use the `--` option. + ## Options - **`--`** @@ -75,6 +83,24 @@ To run the application, the `dotnet run` command resolves the dependencies of th Builds and runs the app using the specified [framework](../../standard/frameworks.md). The framework must be specified in the project file. +- **`--file `** + + The path to the file-based app to run. If a path isn't specified, the current directory is used to find and run the file. For more information on file-based apps, see [Build file-based C# apps](/dotnet/csharp/fundamentals/tutorials/file-based-programs). + + On Unix, you can run file-based apps directly, using the source file name on the command line instead of `dotnet run`. First, ensure the file has execute permissions. Then, add a shebang line `#!` as the first line of the file, for example: + + ```csharp + #!/usr/bin/env dotnet run + ``` + + Then you can run the file directly from the command line: + + ```bash + ./ConsoleApp.cs + ``` + + Introduced in .NET SDK 10.0.100. + - **`--force`** Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the *project.assets.json* file. @@ -155,6 +181,14 @@ The environment is constructed in the same order as this list, so the `-e|--envi dotnet run ``` +- Run the specified file-based app in the current directory: + + ```dotnetcli + dotnet run --file ConsoleApp.cs + ``` + + File-based app support was added in .NET SDK 10.0.100. + - Run the specified project: ```dotnetcli @@ -178,3 +212,16 @@ The environment is constructed in the same order as this list, so the `-e|--envi ```dotnetcli dotnet run --verbosity m ``` + +- Run the project in the current directory using the specified framework and pass arguments to the application: + + ```dotnetcli + dotnet run -f net6.0 -- arg1 arg2 + ``` + + In the following example, three arguments are passed to the application. One argument is passed using `-`, and two arguments are passed after `--`: + + ```dotnetcli + dotnet run -f net6.0 -arg1 -- arg2 arg3 + ``` + \ No newline at end of file diff --git a/docs/fundamentals/code-analysis/quality-rules/ca2017.md b/docs/fundamentals/code-analysis/quality-rules/ca2017.md index 9b765669de2f1..9ee3d60a013cb 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca2017.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca2017.md @@ -1,7 +1,8 @@ --- title: "CA2017: Parameter count mismatch (code analysis)" description: "Learn about code analysis rule CA2017: Parameter count mismatch" -ms.date: 01/19/2022 +ms.date: 09/24/2025 +ai-usage: ai-assisted f1_keywords: - "LoggerMessageDefineAnalyzer" - "CA2017" @@ -9,6 +10,9 @@ helpviewer_keywords: - "LoggerMessageDefineAnalyzer" - "CA2017" author: Youssef1313 +dev_langs: + - CSharp + - VB --- # CA2017: Parameter count mismatch @@ -36,6 +40,14 @@ Match the number of placeholders in the template format with the number of passe Do not suppress a warning from this rule. +## Example + +The following example shows methods that violate CA2017 and methods that satisfy the rule. + +:::code language="csharp" source="snippets/csharp/all-rules/ca2017.cs" id="snippet1"::: + +:::code language="vb" source="snippets/vb/all-rules/ca2017-parameter-count-mismatch_1.vb"::: + ## See also - [Reliability rules](reliability-warnings.md) diff --git a/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/all-rules.csproj b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/all-rules.csproj index 48700336aa492..b286c3c5c450a 100644 --- a/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/all-rules.csproj +++ b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/all-rules.csproj @@ -9,6 +9,8 @@ + + diff --git a/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca2017.cs b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca2017.cs new file mode 100644 index 0000000000000..da627345b1652 --- /dev/null +++ b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca2017.cs @@ -0,0 +1,31 @@ +using Microsoft.Extensions.Logging; + +namespace ca2017 +{ + // + public class LoggingExample + { + private readonly ILogger _logger; + + public LoggingExample(ILogger logger) + { + _logger = logger; + } + + public void ExampleMethod() + { + string name = "Alice"; + int age = 30; + + // Violates CA2017: Too few arguments for placeholders. + _logger.LogInformation("User {Name} is {Age} years old and lives in {City}", name, age); + + // Violates CA2017: Too many arguments for placeholders. + _logger.LogError("Error occurred: {Message}", "Something went wrong", "Extra argument"); + + // Correct usage: Matching number of placeholders and arguments. + _logger.LogInformation("User {Name} is {Age} years old", name, age); + } + } + // +} diff --git a/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/all-rules.vbproj b/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/all-rules.vbproj index a5dec9dd3b254..a651c1e18355e 100644 --- a/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/all-rules.vbproj +++ b/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/all-rules.vbproj @@ -8,6 +8,8 @@ + + diff --git a/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/ca2017-parameter-count-mismatch_1.vb b/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/ca2017-parameter-count-mismatch_1.vb new file mode 100644 index 0000000000000..f61ff6295d485 --- /dev/null +++ b/docs/fundamentals/code-analysis/quality-rules/snippets/vb/all-rules/ca2017-parameter-count-mismatch_1.vb @@ -0,0 +1,25 @@ +Imports Microsoft.Extensions.Logging + +Public Class LoggingExample + + Private ReadOnly _logger As ILogger(Of LoggingExample) + + Public Sub New(logger As ILogger(Of LoggingExample)) + _logger = logger + End Sub + + Public Sub ExampleMethod() + Dim name As String = "Alice" + Dim age As Integer = 30 + + ' Violates CA2017: Too few arguments for placeholders. + _logger.LogInformation("User {Name} is {Age} years old and lives in {City}", name, age) + + ' Violates CA2017: Too many arguments for placeholders. + _logger.LogError("Error occurred: {Message}", "Something went wrong", "Extra argument") + + ' Correct usage: Matching number of placeholders and arguments. + _logger.LogInformation("User {Name} is {Age} years old", name, age) + End Sub + +End Class diff --git a/includes/cli-arguments-project-solution-file.md b/includes/cli-arguments-project-solution-file.md new file mode 100644 index 0000000000000..74d417e64a9ea --- /dev/null +++ b/includes/cli-arguments-project-solution-file.md @@ -0,0 +1,14 @@ +--- +ms.date: 09/25/2025 +ms.topic: include +--- + +`PROJECT | SOLUTION | FILE` + +The project or solution or C# (file-based app) file to operate on. If a file isn't specified, MSBuild searches the current directory for a project or solution. + +- `PROJECT` is the path and filename of a C#, F#, or Visual Basic project file, or the path to a directory that contains a C#, F#, or Visual Basic project file. + +- `SOLUTION` is the path and filename of a solution file (*.sln* or *.slnx* extension), or the path to a directory that contains a solution file. + +- `FILE` is an argument added in .NET 10. The path and filename of a file-based app. File-based apps are contained within a single file that is built and run without a corresponding project (*.csproj*) file. For more information, see [Build file-based C# apps](/dotnet/csharp/fundamentals/tutorials/file-based-programs).