Skip to content

Commit c414c9c

Browse files
Merge pull request #10448 from MicrosoftDocs/main638648102498150171sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 87f73cb + 71dc852 commit c414c9c

8 files changed

+32
-34
lines changed

docs/containers/container-launch-settings.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Visual Studio Container Tools launch settings
33
author: ghogen
44
description: Learn about the launch settings for Container Tools that are related to how Visual Studio handles containerized apps.
55
ms.author: ghogen
6-
ms.date: 08/15/2019
6+
ms.date: 10/7/2024
77
ms.subservice: container-tools
88
ms.topic: reference
99
---
@@ -12,7 +12,11 @@ ms.topic: reference
1212

1313
In the *Properties* folder in an ASP.NET Core project, you can find the `launchSettings.json` file, which contains settings that control how your web app is started on your development machine. For detailed information on how this file is used in ASP.NET development, see [Use multiple environments in ASP.NET Core](/aspnet/core/fundamentals/environments?view=aspnetcore-2.2&preserve-view=true).
1414

15-
You can edit this file directly, but in Visual Studio IDE, you can also edit the properties in this file through the UI. Choose the dropdown list next to the launch option (for example, `Docker` or `.NET SDK`), and then choose **Debug Properties**.
15+
You can edit this file directly, but in Visual Studio IDE, you can also edit the properties in this file through the UI. Choose the dropdown list next to the launch option (for example, `Docker` or `.NET SDK`), and then choose **Debug Properties** for a single-container project.
16+
17+
![Screenshot of launch profile dialog, showing launch settings for a container launch profile.](./media/container-launch-settings/launch-profiles-container.png)
18+
19+
For Docker Compose, choose **Manage Docker Compose Launch Settings**, and see [Launch a subset of compose services](launch-profiles.md).
1620

1721
In *launchSettings.json*, the settings in the **Docker** section are related to how Visual Studio handles containerized apps.
1822

@@ -61,22 +65,28 @@ The following table shows the properties that can be set in this section:
6165

6266
::: moniker range=">=vs-2022"
6367

64-
| Setting name | Example | Description |
65-
| -------------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
66-
| commandLineArgs | `"commandLineArgs": "--mysetting myvalue"` | These command-line arguments for starting your app are used when launching your project in the container. |
67-
| containerRunArguments|`"containerRunArguments": "-l mylabel=value"`|Like `dockerfileRunArguments`, but for use with the .NET SDK container build type. |
68-
|DockerfileRunArguments|`dockerfileRunArguments": "-l mylabel=value"`|Additional arguments to pass to the [`docker run`](https://docs.docker.com/engine/reference/commandline/run/) command. <br>/<br/> This setting only applies to projects that use the Dockerfile container build type. <br/><br/> In Visual Studio 17.3 and later, you can use the following replacement tokens added:<br/><br/> - `{ProjectDir}` - Full path to the project directory. <br/><br/> - `{OutDir}` - The value of the MSBuild property OutDir.|
69-
| environmentVariables | `"environmentVariables":` {<br/> `"ASPNETCORE_URLS": "https://+:443;http://+:80"`, <br/> `"ASPNETCORE_HTTPS_PORT": "44381"` <br/> } | These environment variable values are passed to the process when it's launched in the container. |
70-
| httpPort | `"httpPort": 24051` | This port on the host is mapped to the container's port 80 when launching the container. |
71-
| launchBrowser | `"launchBrowser": true` | Indicates whether to launch the browser after successfully launching the project. |
72-
| launchBrowserTimeout | `"launchBrowserTimeout": 1` | The maximum amount of time (in seconds) to wait for the app to be ready before launching the browser. |
73-
| launchUrl | `"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}"` | This URL is used when launching the browser. Supported replacement tokens for this string are: <br/><br/> - `{Scheme}` - Replaced with either `http` or `https`, depending on whether SSL is used. <br/><br/> - `{ServiceHost}` - Usually replaced with `localhost`. <br/> When you're targeting Windows containers on Windows 10 RS3 or older, though, it's replaced with the container's IP. <br/><br/> - `{ServicePort}` - Usually replaced with either sslPort or httpPort, depending on whether SSL is used. <br/> When you're targeting Windows containers on Windows 10 RS3 or older, though, it's replaced with either `443` or `80`, depending on whether SSL is used. |
74-
| publishAllPorts | `"publishAllPorts": true` | If true, pass `-P` to `docker run`, which publishes all exposed ports to a random port. See [Docker documentation](https://docs.docker.com/engine/reference/commandline/run/). However, when you specify `sslPort`, Visual Studio still passes `-p 5002:443`, so your service should still be listening on port 5002.|
75-
| sslPort | `"sslPort": 44381` | This port on the host is mapped to the container's port 443 when launching the container. |
76-
| useSSL | `"useSSL": true` | Indicates whether to use SSL when launching the project. If `useSSL` isn't specified, then SSL is used when `sslPort > 0`. |
68+
| Property in Debug Profile UI | Setting name in launchSettings.json |Example|Description|
69+
| - | - | - | - |
70+
|Command line arguments| commandLineArgs | `"commandLineArgs": "--mysetting myvalue"` | These command-line arguments for starting your app are used when launching your project in the container. |
71+
|Container run arguments| containerRunArguments<br/>ContainerRunArguments|`"containerRunArguments": "-l mylabel=value"`| Additional arguments to pass to the [`docker run`](https://docs.docker.com/engine/reference/commandline/run/) command. <br><br/> (Use the lowercase version in Visual Studio 17.12 and later. The uppercase version was introduced in Visual Studio 17.9 and is provided for backward compatibility.) <br/><br/> You can use the following replacement tokens:<br/><br/> - `{ProjectDir}` - Full path to the project directory. <br/><br/> - `{OutDir}` - The value of the MSBuild property OutDir. |
72+
|N/A|DockerfileRunArguments|`dockerfileRunArguments": "-l mylabel=value"`|Like `containerRunArguments`, but only for projects that use the Dockerfile build type. For Visual Studio 17.12 and later, it is recommended to use `containerRunArguments` instead.|
73+
|Environment Variables| environmentVariables | `"environmentVariables":` {<br/> `"ASPNETCORE_URLS": "https://+:443;http://+:80"`, <br/> `"ASPNETCORE_HTTPS_PORT": "44381"` <br/> } | These environment variable values are passed to the process when it's launched in the container. |
74+
|Container Name| containerName | `mycontainer` | (17.12 and later) A name for the container matching the regular expression `[a-zA-Z0-9][a-zA-Z0-9_.-]`.|
75+
|Container environment files| containerRunEnvironmentFiles | `"containerRunEnvironmentFiles": "abc.env;xyz.env"` | (17.12 and later) A list of environment variable files (`.env` files) separated by semicolons. See [.env file syntax](https://docs.docker.com/compose/how-tos/environment-variables/variable-interpolation/#env-file-syntax). |
76+
|Http Port| httpPort | `"httpPort": 24051` | This port on the host is mapped to the container's port 80 when launching the container. |
77+
|Launch Browser| launchBrowser | `"launchBrowser": true` | Indicates whether to launch the browser after successfully launching the project. |
78+
|N/A| launchBrowserTimeout | `"launchBrowserTimeout": 1` | The maximum amount of time (in seconds) to wait for the app to be ready before launching the browser (Docker Compose only). |
79+
|Url | launchUrl | `"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}"` | This URL is used when launching the browser. Supported replacement tokens for this string are: <br/><br/> - `{Scheme}` - Replaced with either `http` or `https`, depending on whether SSL is used. <br/><br/> - `{ServiceHost}` - Usually replaced with `localhost`. <br/> When you're targeting Windows containers on Windows 10 RS3 or older, though, it's replaced with the container's IP. <br/><br/> - `{ServicePort}` - Usually replaced with either sslPort or httpPort, depending on whether SSL is used. <br/> When you're targeting Windows containers on Windows 10 RS3 or older, though, it's replaced with either `443` or `80`, depending on whether SSL is used. |
80+
| Publish all ports | publishAllPorts | `"publishAllPorts": true` | If true, pass `-P` to `docker run`, which publishes all exposed ports to a random port. See [Docker documentation](https://docs.docker.com/engine/reference/commandline/run/). However, when you specify `sslPort`, Visual Studio still passes `-p 5002:443`, so your service should still be listening on port 5002.|
81+
| Ssl Port| sslPort | `"sslPort": 44381` | This port on the host is mapped to the container's port 443 when launching the container. |
82+
| N/A | useSSL | `"useSSL": true` | Indicates whether to use SSL when launching the project. If `useSSL` isn't specified, then SSL is used when `sslPort > 0`. |
83+
84+
Not all settings are available in the UI, for example, `useSSL`. To change those settings, edit `launchSettings.json` directly.
85+
86+
The setting `DockerfileRunArguments` is superceded in Visual Studio 2022 17.12 and later by `containerRunArguments`, which can be set in the Launch Profiles UI as `Container run arguments`.
7787

7888
> [!NOTE]
79-
> If the same settings, for example, `DockerfileRunArguments`, is found in both the project file and in the launch settings file, the value in the launch settings file takes precedence.
89+
> If the same setting is found in both the project file and in the launch settings file, the value in the launch settings file takes precedence.
8090
8191
::: moniker-end
8292

56.3 KB
Loading

docs/get-started/csharp/tutorial-windows-forms-match-game-icons.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ It stores the randomly chosen symbols.
5959
:::code language="vb" source="../../snippets/visualbasic/VS_Snippets_VBCSharp/vbexpresstutorial4step2_3_4/vb/form1.vb" id="Snippet1":::
6060
---
6161

62-
[!INCLUDE [devlang-control-csharp-vb](../includes/devlang-control-csharp-vb.md)]
63-
6462
If you're using C#, be sure you put the code after the opening curly brace and just after the class declaration (`public partial class Form1 : Form`). If you're using Visual Basic, put the code right after the class declaration (`Public Class Form1`).
6563

6664
You can use list objects to keep track of different types of items.

docs/get-started/csharp/tutorial-windows-forms-match-game-labels.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ They keep track of, or refer to Label objects.
4747
:::code language="vb" source="../../snippets/visualbasic/VS_Snippets_VBCSharp/vbexpresstutorial4step5/vb/form1.vb" id="Snippet5":::
4848
---
4949

50-
[!INCLUDE [devlang-control-csharp-vb](../includes/devlang-control-csharp-vb.md)]
51-
5250
These statements don't cause Label controls to appear on the form because there's no `new` keyword.
5351
When the program starts, both `firstClicked` and `secondClicked` are set to `null` for C# or `Nothing` for Visual Basic.
5452

docs/get-started/csharp/tutorial-windows-forms-match-game-play.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ Those labels continue to be displayed.
4848
:::code language="vb" source="../../snippets/visualbasic/VS_Snippets_VBCSharp/vbexpresstutorial4step7/vb/form1.vb" id="Snippet9":::
4949
---
5050

51-
[!INCLUDE [devlang-control-csharp-vb](../includes/devlang-control-csharp-vb.md)]
52-
5351
The `if` statement checks whether the icon in the first label that the player chooses is the same as the icon in the second label.
5452
If the icons are the same, the program runs its three statements.
5553
The first two statements reset the `firstClicked` and `secondClicked` reference variables.

docs/get-started/csharp/tutorial-windows-forms-math-quiz-add-math-problems.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ms.custom: vs-acquisition
55
dev_langs:
66
- "CSharp"
77
- "VB"
8-
ms.date: 03/15/2023
8+
ms.date: 10/18/2024
99
ms.topic: tutorial
1010
author: anandmeg
1111
ms.author: meghaanand
@@ -37,7 +37,7 @@ This tutorial builds on a previous tutorial, [Create a math quiz WinForms app](t
3737

3838
1. On the menu bar, select **View** > **Code**. *Form1.cs* or *Form1.vb* appears, depending on the programming language that you're using, so that you can view the code behind the form.
3939

40-
1. Create a <xref:System.Random> object by adding a `new` statement near the top of the code.
40+
1. Create a <xref:System.Random> object by adding a `new` statement near the top of the code in *Form1.cs* or *Form1.vb*.
4141

4242
### [C#](#tab/csharp)
4343
:::code language="csharp" source="../../snippets/csharp/VS_Snippets_VBCSharp/vbexpresstutorial3step2/cs/form1.cs" id="Snippet1":::
@@ -46,15 +46,13 @@ This tutorial builds on a previous tutorial, [Create a math quiz WinForms app](t
4646
:::code language="vb" source="../../snippets/visualbasic/VS_Snippets_VBCSharp/vbexpresstutorial3step2/vb/form1.vb" id="Snippet1":::
4747
---
4848

49-
[!INCLUDE [devlang-control-csharp-vb](../includes/devlang-control-csharp-vb.md)]
50-
5149
You can use `new` statements like this one to create buttons, labels, panels, OpenFileDialogs, ColorDialogs, SoundPlayers, Randoms, and even forms. These items are called *objects*.
5250

5351
When you run your program, the form is started. The code behind it creates a Random object and names it **randomizer**.
5452

5553
Your quiz needs variables to store the random numbers that it creates for each problem. Before using variables, you declare them, which means listing their names and data types.
5654

57-
1. Add two integer variables to the form, and name them **addend1** and **addend2**.
55+
1. Add two integer variables to the form, and name them **addend1** and **addend2** in *Form1.cs* or *Form1.vb*.
5856

5957
> [!NOTE]
6058
> An integer variable is known as an *int* in C# or an *Integer* in Visual Basic. This kind of variable stores a positive or negative number from -2147483648 through 2147483647 and can store only whole numbers, not decimals.
@@ -68,7 +66,7 @@ This tutorial builds on a previous tutorial, [Create a math quiz WinForms app](t
6866
:::code language="vb" source="../../snippets/visualbasic/VS_Snippets_VBCSharp/vbexpresstutorial3step2/vb/form1.vb" id="Snippet2":::
6967
---
7068

71-
1. Add a method that's named `StartTheQuiz()`. This method uses the Random object's <xref:System.Random.Next> method to generate random numbers for the labels. `StartTheQuiz()` will eventually fill in all the problems and then start the timer, so add this information to the summary comment. The function should look like the following code.
69+
1. Add a method that's named `StartTheQuiz()` *Form1.cs* or *Form1.vb*. This method uses the Random object's <xref:System.Random.Next> method to generate random numbers for the labels. `StartTheQuiz()` will eventually fill in all the problems and then start the timer, so add this information to the summary comment. The function should look like the following code.
7270

7371
### [C#](#tab/csharp)
7472
:::code language="csharp" source="../../snippets/csharp/VS_Snippets_VBCSharp/vbexpresstutorial3step2/cs/form1.cs" id="Snippet3":::
@@ -94,7 +92,7 @@ This tutorial builds on a previous tutorial, [Create a math quiz WinForms app](t
9492

9593
The next step is to declare variables and provide random values for the other math problems.
9694

97-
1. Add integer variables for the remaining math problems to your form, after the addition problem variables. The code should look like the following sample.
95+
1. Add integer variables for the remaining math problems to your form, after the addition problem variables. The code in *Form1.cs* or *Form1.vb* should look like the following sample.
9896

9997
### [C#](#tab/csharp)
10098
:::code language="csharp" source="../../snippets/csharp/VS_Snippets_VBCSharp/vbexpresstutorial3step7/cs/form1.cs" range="14-38":::
@@ -103,7 +101,7 @@ The next step is to declare variables and provide random values for the other ma
103101
:::code language="vb" source="../../snippets/visualbasic/VS_Snippets_VBCSharp/vbexpresstutorial3step7/vb/form1.vb" range="2-27":::
104102
---
105103

106-
1. Modify the `StartTheQuiz()` method by adding the following code, starting with the "Fill in the subtraction problem" comment.
104+
1. Modify the `StartTheQuiz()` method in *Form1.cs* or *Form1.vb* by adding the following code, starting with the "Fill in the subtraction problem" comment.
107105

108106
### [C#](#tab/csharp)
109107
:::code language="csharp" source="../../snippets/csharp/VS_Snippets_VBCSharp/vbexpresstutorial3step7/cs/form1.cs" range="51-94":::

docs/get-started/csharp/tutorial-windows-forms-math-quiz-add-timer.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ To keep track of time during the quiz, you use a timer component. You also need
4242
:::code language="vb" source="../../snippets/visualbasic/VS_Snippets_VBCSharp/vbexpresstutorial3step7/vb/form1.vb" id="Snippet15":::
4343
---
4444

45-
[!INCLUDE [devlang-control-csharp-vb](../includes/devlang-control-csharp-vb.md)]
46-
4745
2. In **Windows Forms Designer**, move a <xref:System.Windows.Forms.Timer> control from the **Components** category of the **Toolbox** to your form. The control appears in the gray area at the bottom of the design window.
4846

4947
3. On the form, select the **timer1** icon that you just added, and set its **Interval** property to **1000**. Because this interval is in milliseconds, a value of 1000 causes the timer to raise a <xref:System.Windows.Forms.Timer.Tick> event every second.

docs/get-started/csharp/tutorial-windows-forms-math-quiz-customize-ui.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ The quiz contains <xref:System.Windows.Forms.NumericUpDown> controls that quiz t
5353
:::code language="vb" source="../../snippets/visualbasic/VS_Snippets_VBCSharp/vbexpresstutorial3step5_6/vb/form1.vb" id="Snippet11":::
5454
---
5555

56-
[!INCLUDE [devlang-control-csharp-vb](../includes/devlang-control-csharp-vb.md)]
57-
5856
In this code:
5957

6058
- The first line declares the method. It includes a parameter that's named `sender`. In C#, the parameter is `object sender`. In Visual Basic, it's `sender As System.Object`. This parameter refers to the object whose event is firing, which is known as the sender. In this case, the sender object is the NumericUpDown control.

0 commit comments

Comments
 (0)