Skip to content

Commit 73d9e16

Browse files
authored
Provide proper escaping of delimiters, terminators, and quotes (#44538)
* Address issue #44537 * Remove tabs
1 parent b4b9103 commit 73d9e16

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

docs/core/containers/publish-configuration.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Containerize a .NET app reference
33
description: Reference material for containerizing a .NET app and configuring the container image.
44
ms.topic: reference
5-
ms.date: 01/07/2025
5+
ms.date: 01/27/2025
66
---
77

88
# Containerize a .NET app reference
@@ -176,12 +176,20 @@ To specify multiple tags, use a semicolon-delimited set of tags in the `Containe
176176
Tags can only contain up to 127 alphanumeric characters, periods, underscores, and dashes. They must start with an alphanumeric character or an underscore. Any other form results in an error being thrown.
177177

178178
> [!NOTE]
179-
> When using `ContainerImageTags`, the tags are delimited by a `;` character. If you're calling `dotnet publish` from the command line (as is the case with most CI/CD environments), you need to outer wrap the values in a single `'` and inner wrap with double quotes `"`, for example (`='"tag-1;tag-2"'`). Consider the following `dotnet publish` command:
179+
> When using `ContainerImageTags` or any MSBuild property that needs to configure `;` delimited values. If you're calling `dotnet publish` from the command line (as is the case with most CI/CD environments), you need to understand the limitations of the environment's inability to disambiguate delimiters and quotations, thus requiring proper escaping. This differs between PowerShell and Bash. Consider the following `dotnet publish` commands in their respective environments:
180180
>
181-
> ```dotnetcli
182-
> dotnet publish -p ContainerImageTags='"1.2.3-alpha2;latest"'
181+
> ```powershell
182+
> dotnet publish --os linux --arch x64 /t:PublishContainer /p:ContainerImageTags=`"1.2.3-alpha2`;latest`"
183183
> ```
184184
>
185+
> In PowerShell, both the `;` and `"` characters need to be escaped.
186+
>
187+
> ```bash
188+
> dotnet publish --os linux --arch x64 /t:PublishContainer /p:ContainerImageTags=\"1.2.3-alpha2;latest\"
189+
> ```
190+
>
191+
> In Bash, only the `"` character needs to be escaped.
192+
>
185193
> This results in two images being generated: `my-app:1.2.3-alpha2` and `my-app:latest`.
186194
187195
> [!TIP]

0 commit comments

Comments
 (0)