Skip to content

Commit 8550c97

Browse files
Learn Build Service GitHub AppLearn Build Service GitHub App
authored andcommitted
Merging changes synced from https://github.com/MicrosoftDocs/visualstudio-docs-pr (branch live)
2 parents eb95411 + 8e527d3 commit 8550c97

File tree

4 files changed

+168
-29
lines changed

4 files changed

+168
-29
lines changed

docs/containers/docker-compose-properties.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Docker Compose build settings
33
author: ghogen
44
description: Learn how to edit the Docker Compose build properties to customize how Visual Studio builds and runs a Docker Compose application.
55
ms.author: ghogen
6-
ms.date: 04/06/2021
6+
ms.date: 12/19/2024
77
ms.subservice: container-tools
88
ms.topic: reference
99
---
@@ -26,25 +26,27 @@ You can add the property setting to an existing `PropertyGroup` element, or if t
2626

2727
## Docker Compose MSBuild properties
2828

29-
The following table shows the MSBuild properties available for Docker Compose projects.
30-
31-
| Property name | Location | Description | Default value |
32-
|---------------|----------|-------------|----------------|
33-
|AdditionalComposeFilePaths|dcproj|Specifies additional compose files in a semicolon-delimited list to be sent out to docker-compose.exe for all commands. Relative paths from the Docker Compose project file (dcproj) are allowed.|-|
34-
|DockerComposeBaseFilePath|dcproj|Specifies the first part of the filenames of the Docker Compose files, without the `.yml` extension. For example: <br>1. DockerComposeBaseFilePath = null/undefined: use the base file path `docker-compose`, and files will be named *docker-compose.yml* and *docker-compose.override.yml*.<br>2. DockerComposeBaseFilePath = *mydockercompose*: files will be named *mydockercompose.yml* and *mydockercompose.override.yml*.<br> 3. DockerComposeBaseFilePath = *..\mydockercompose*: files will be up one level. |`docker-compose`|
35-
|DockerComposeBuildArguments|dcproj|Specifies the extra parameters to pass to the `docker-compose build` command. For example, `--parallel --pull`. |
36-
|DockerComposeDownArguments|dcproj|Specifies the extra parameters to pass to the `docker-compose down` command. For example, `--timeout 500`.|-|
37-
| DockerComposeEnvFilePath | dcproj | The relative path to an .env file that's passed to `docker compose` commands via `--env-file`. See [Use the env_file attribute](https://docs.docker.com/compose/how-tos/environment-variables/set-environment-variables/#use-the-env_file-attribute). | Empty |
38-
|DockerComposeProjectName| dcproj | If specified, overrides the project name for a Docker Compose project. | "dockercompose" + auto-generated hash |
39-
|DockerComposeProjectPath|csproj or vbproj|The relative path to the Docker Compose project (dcproj) file. Set this property when publishing the service project to find the associated image build settings stored in the docker-compose.yml file.|-|
40-
|DockerComposeProjectsToIgnore|dcproj| Specifies projects to be ignored by Docker Compose tools during debug. This property can be used for any project. File paths can be specified one of two ways: <br> 1. Relative to dcproj. For example, `<DockerComposeProjectsToIgnore>path\to\AngularProject1.csproj</DockerComposeProjectsToIgnore>`. <br> 2. Absolute paths.<br> **Note**: The paths should be separated by the delimiter character `;`.|-|
41-
|DockerComposeUpArguments|dcproj|Specifies the extra parameters to pass to the `docker-compose up` command. For example, `--timeout 500`.|-|
42-
|DockerDevelopmentMode| dcproj | Controls whether the user project is built in the container. The allowed values of **Fast** or **Regular** control [which stages are built](https://aka.ms/containerfastmode) in a Dockerfile. The Debug configuration is Fast mode by default and Regular mode otherwise. | Fast |
43-
|DockerLaunchAction| dcproj | Specifies the launch action to perform on F5 or Ctrl+F5. Allowed values are None, LaunchBrowser, and LaunchWCFTestClient. | None |
44-
|DockerLaunchBrowser| dcproj | Indicates whether to launch the browser. Ignored if DockerLaunchAction is specified. | False |
45-
|DockerServiceName| dcproj| If DockerLaunchAction or DockerLaunchBrowser are specified, then DockerServiceName specifies which service referenced in the `docker-compose` file gets launched.|-|
46-
|DockerServiceUrl| dcproj | The URL to use when launching the browser. Valid replacement tokens are "{ServiceIPAddress}", "{ServicePort}", and "{Scheme}". For example: {Scheme}://{ServiceIPAddress}:{ServicePort}|-|
47-
|DockerTargetOS| dcproj | The target OS used when building the Docker image.|-|
29+
The following table shows the MSBuild properties available for Docker Compose projects (`.dcproj` files).
30+
31+
| Property name | Description |
32+
|---------------|-------------|
33+
|AdditionalComposeFilePaths|Specifies additional compose files in a semicolon-delimited list to be sent out to docker-compose.exe for all commands. Relative paths from the Docker Compose project file (dcproj) are allowed.|
34+
|DependencyAwareStart|Enables a different way of launching the app that supports the Docker Compose properties [`depends_on`](https://docs.docker.com/reference/compose-file/services/#depends_on) and [`healthcheck`](https://docs.docker.com/reference/compose-file/services/#healthcheck), which control service startup order and health checks.<br/><br/>Requires Visual Studio 17.13 or later.<br/><br/>Default value: False |
35+
|DockerComposeBaseFilePath|Specifies the first part of the filenames of the Docker Compose files, without the `.yml` extension. For example: <br>1. DockerComposeBaseFilePath = null/undefined: use the base file path `docker-compose`, and files will be named *docker-compose.yml* and *docker-compose.override.yml*.<br>2. DockerComposeBaseFilePath = *mydockercompose*: files will be named *mydockercompose.yml* and *mydockercompose.override.yml*.<br> 3. DockerComposeBaseFilePath = *..\mydockercompose*: files will be up one level.<br/><br/>Default value: `docker-compose`|
36+
|DockerComposeBuildArguments|Specifies the extra parameters to pass to the `docker-compose build` command. For example, `--parallel --pull`. |
37+
|DockerComposeDownArguments|Specifies the extra parameters to pass to the `docker-compose down` command. For example, `--timeout 500`.|
38+
| DockerComposeEnvFilePath | The relative path to an .env file that's passed to `docker compose` commands via `--env-file`. See [Use the env_file attribute](https://docs.docker.com/compose/how-tos/environment-variables/set-environment-variables/#use-the-env_file-attribute).<br/><br/>Default value: Empty |
39+
|DockerComposeProjectName | If specified, overrides the project name for a Docker Compose project. <br/><br/>Default value: "dockercompose" + auto-generated hash |
40+
|DockerComposeProjectsToIgnore| Specifies projects to be ignored by Docker Compose tools during debug. This property can be used for any project. File paths can be specified one of two ways: <br> 1. Relative to dcproj. For example, `<DockerComposeProjectsToIgnore> path\to\AngularProject1.csproj </DockerComposeProjectsToIgnore>`. <br> 2. Absolute paths.<br> **Note**: The paths should be separated by the delimiter character `;`.|
41+
|DockerComposeUpArguments|Specifies the extra parameters to pass to the `docker-compose up` command. For example, `--timeout 500`.|
42+
|DockerDevelopmentMode | Controls whether the user project is built in the container. The allowed values of **Fast** or **Regular** control [which stages are built](https://aka.ms/containerfastmode) in a Dockerfile. The Debug configuration is Fast mode by default and Regular mode otherwise. <br/><br/>Default value: Fast |
43+
|DockerLaunchAction | Specifies the launch action to perform on F5 or Ctrl+F5. Allowed values are None, LaunchBrowser, and LaunchWCFTestClient.<br/><br/>Default value: None |
44+
|DockerLaunchBrowser | Indicates whether to launch the browser. Ignored if DockerLaunchAction is specified. <br/><br/>Default value: False |
45+
|DockerServiceName| If DockerLaunchAction or DockerLaunchBrowser are specified, then DockerServiceName specifies which service referenced in the `docker-compose` file gets launched.|
46+
|DockerServiceUrl | The URL to use when launching the browser. Valid replacement tokens are "{ServiceIPAddress}", "{ServicePort}", and "{Scheme}". For example: {Scheme}://{ServiceIPAddress}:{ServicePort}|
47+
|DockerTargetOS | The target OS used when building the Docker image.|
48+
49+
In addition, the property `DockerComposeProjectPath` in a `.csproj` or `.vbproj` project file specifies the relative path to the Docker Compose project (`.dcproj`) file. Set this property when publishing the service project to find the associated image build settings stored in the *docker-compose.yml* file.
4850

4951
## Example
5052

docs/containers/tutorial-multicontainer.md

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ Congratulations, you're running a Docker Compose application with a custom Docke
294294
// A delay is a quick and dirty way to work around the fact that
295295
// the mywebapi service might not be immediately ready on startup.
296296
// See the text for some ideas on how you can improve this.
297-
// Uncomment for .NET 8 only
297+
// Uncomment if not using healthcheck (Visual Studio 17.13 or later)
298298
// await System.Threading.Tasks.Task.Delay(10000);
299299
300300
// mywebapi is the service name, as listed in docker-compose.yml.
@@ -312,14 +312,12 @@ Congratulations, you're running a Docker Compose application with a custom Docke
312312
}
313313
```
314314

315-
> [!NOTE]
316-
> In real-world code, you shouldn't dispose `HttpClient` after every request. For best practices, see [Use HttpClientFactory to implement resilient HTTP requests](/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests).
317-
318-
The URI given references a service name defined in the *docker-compose.yml* file. Docker Compose sets up a default network for communication between containers using the listed service names as hosts.
315+
> [!NOTE]
316+
> In real-world code, you shouldn't dispose `HttpClient` after every request. For best practices, see [Use HttpClientFactory to implement resilient HTTP requests](/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests).
319317

320-
The code shown here works with .NET 8 and later, which sets up a user account in the Dockerfile without administrator privileges, and exposes port 8080 because the HTTP default port 80 is not accessible without elevated privilege.
318+
The URI given references a service name defined in the *docker-compose.yml* file. Docker Compose sets up a default network for communication between containers using the listed service names as hosts.
321319

322-
The delay is used here as a workaround for .NET 8 only, because this example code could run immediately on application launch, before the MyWebAPI service is ready to receive web requests.
320+
The code shown here works with .NET 8 and later, which sets up a user account in the Dockerfile without administrator privileges, and exposes port 8080 because the HTTP default port 80 is not accessible without elevated privilege.
323321

324322
1. In the `Index.cshtml` file, add a line to display `ViewData["Message"]` so that the file looks like the following code:
325323

@@ -337,7 +335,7 @@ Congratulations, you're running a Docker Compose application with a custom Docke
337335
</div>
338336
```
339337

340-
This code displays the value of the counter returned from the Web API project.
338+
This code displays the value of the counter returned from the Web API project. It increments every time the user accesses or refreshes the page.
341339

342340
## Add Docker Compose support
343341

@@ -403,6 +401,61 @@ Congratulations, you're running a Docker Compose application with a custom Docke
403401

404402
Make sure the indentation is at the same level as the other two services.
405403

404+
1. (Visual Studio 17.13 or later) The dependent services demonstrate a common problem. The HTTP request in the front end's main page could run immediately on application launch, before the `mywebapi` service is ready to receive web requests. If you're using Visual Studio 17.13 or later, you can use the Docker Compose features `depends_on` and `healthcheck` in *docker-compose.yml* to make the projects start in the right sequence, and have them be ready to serve requests when required. See [Docker Compose - Startup order](https://docs.docker.com/compose/how-tos/startup-order/).
405+
406+
```yml
407+
services:
408+
webfrontend:
409+
image: ${DOCKER_REGISTRY-}webfrontend
410+
depends_on:
411+
mywebapi:
412+
condition: service_healthy
413+
build:
414+
context: .
415+
dockerfile: WebFrontEnd/Dockerfile
416+
417+
mywebapi:
418+
image: ${DOCKER_REGISTRY-}mywebapi
419+
depends_on:
420+
redis:
421+
condition: service_started
422+
healthcheck:
423+
test: curl --fail http://mywebapi:8080/ || exit 1
424+
interval: 20s
425+
timeout: 20s
426+
retries: 5
427+
build:
428+
context: .
429+
dockerfile: MyWebAPI/Dockerfile
430+
431+
redis:
432+
image: redis
433+
```
434+
435+
In this example, the health check uses `curl` to verify that the service is ready to process requests. If the image you're using doesn't have `curl` installed, add lines to the `base` stage of the MyWebAPI Dockerfile to install it. This step requires elevated privileges, but you can restore the normal user privileges after installing it as shown here (for the Debian images used in this example):
436+
437+
```dockerfile
438+
USER root
439+
RUN apt-get update && apt-get install -y curl
440+
USER $APP_UID
441+
```
442+
443+
> [!NOTE]
444+
> If you're using a Linux distro, like Alpine, that doesn't support `apt-get`, try `RUN apk --no-cache add curl` instead.
445+
446+
These Docker Compose features require a property setting in the Docker Compose project file (`.dcproj`). Set the property `DependencyAwareStart` to true:
447+
448+
```xml
449+
<PropertyGroup>
450+
<!-- existing properties -->
451+
<DependencyAwareStart>true</DependencyAwareStart>
452+
</PropertyGroup>
453+
```
454+
455+
This property activates a different way of starting the containers for debugging that supports the service dependency features.
456+
457+
With these changes, the `webfrontend` service will not start until `mywebapi` starts and successfully handles a web request.
458+
406459
1. The first project that you add container orchestration to is set up to be launched when you run or debug. You can configure the launch action in the **Project Properties** for the Docker Compose project. On the Docker Compose project node, right-click to open the context menu, and then choose **Properties**, or use **Alt**+**Enter**. For example, you can change the page that is loaded by customizing the **Service URL** property.
407460

408461
![Screenshot of Docker Compose project properties.](media/tutorial-multicontainer/launch-action.png)

docs/get-started/tutorial-open-project-from-repo.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Tutorial: Open project from repo in Visual Studio"
33
description: In this tutorial, learn how to open a cloned project in a Git or Azure DevOps repository by using Visual Studio and view files in Solution Explorer.
44
ms.custom: vs-acquisition
5-
ms.date: 12/02/2024
5+
ms.date: 12/19/2024
66
ms.subservice: general-ide
77
ms.topic: tutorial
88
author: anandmeg
@@ -314,5 +314,7 @@ For more information, see:
314314
::: moniker range="vs-2022"
315315

316316
- [About Git in Visual Studio](../version-control/git-with-visual-studio.md)
317+
- [Brpwse a repo](../version-control/git-browse-repository.md)
318+
- [Manage a repo](../version-control/git-manage-repository.md)
317319

318320
::: moniker-end

docs/msbuild/toc.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,6 +1894,88 @@ items:
18941894
href: errors/msb6011.md
18951895
- name: MSB6012
18961896
href: errors/msb6012.md
1897+
- name: MSB8000 - MSB8066
1898+
items:
1899+
- name: MSB8000
1900+
href: errors/msb8000.md
1901+
- name: MSB8001
1902+
href: errors/msb8001.md
1903+
- name: MSB8002
1904+
href: errors/msb8002.md
1905+
- name: MSB8003
1906+
href: errors/msb8003.md
1907+
- name: MSB8004
1908+
href: errors/msb8004.md
1909+
- name: MSB8005
1910+
href: errors/msb8005.md
1911+
- name: MSB8006
1912+
href: errors/msb8006.md
1913+
- name: MSB8007
1914+
href: errors/msb8007.md
1915+
- name: MSB8009
1916+
href: errors/msb8009.md
1917+
- name: MSB8010
1918+
href: errors/msb8010.md
1919+
- name: MSB8011
1920+
href: errors/msb8011.md
1921+
- name: MSB8012
1922+
href: errors/msb8012.md
1923+
- name: MSB8013
1924+
href: errors/msb8013.md
1925+
- name: MSB8016
1926+
href: errors/msb8016.md
1927+
- name: MSB8019
1928+
href: errors/msb8019.md
1929+
- name: MSB8020
1930+
href: errors/msb8020.md
1931+
- name: MSB8021
1932+
href: errors/msb8021.md
1933+
- name: MSB8024
1934+
href: errors/msb8024.md
1935+
- name: MSB8025
1936+
href: errors/msb8025.md
1937+
- name: MSB8027
1938+
href: errors/msb8027.md
1939+
- name: MSB8028
1940+
href: errors/msb8028.md
1941+
- name: MSB8029
1942+
href: errors/msb8029.md
1943+
- name: MSB8030
1944+
href: errors/msb8030.md
1945+
- name: MSB8032
1946+
href: errors/msb8032.md
1947+
- name: MSB8036
1948+
href: errors/msb8036.md
1949+
- name: MSB8037
1950+
href: errors/msb8037.md
1951+
- name: MSB8038
1952+
href: errors/msb8038.md
1953+
- name: MSB8040
1954+
href: errors/msb8040.md
1955+
- name: MSB8041
1956+
href: errors/msb8041.md
1957+
- name: MSB8042
1958+
href: errors/msb8042.md
1959+
- name: MSB8053
1960+
href: errors/msb8053.md
1961+
- name: MSB8054
1962+
href: errors/msb8054.md
1963+
- name: MSB8055
1964+
href: errors/msb8055.md
1965+
- name: MSB8056
1966+
href: errors/msb8056.md
1967+
- name: MSB8057
1968+
href: errors/msb8057.md
1969+
- name: MSB8058
1970+
href: errors/msb8058.md
1971+
- name: MSB8059
1972+
href: errors/msb8059.md
1973+
- name: MSB8060
1974+
href: errors/msb8060.md
1975+
- name: MSB8061
1976+
href: errors/msb8061.md
1977+
- name: MSB8066
1978+
href: errors/msb8066.md
18971979
- name: MSB9901 - MSB9904
18981980
items:
18991981
- name: MSB9901

0 commit comments

Comments
 (0)