Skip to content

Commit af40d68

Browse files
Merge pull request #8423 from MicrosoftDocs/main637976487271102998sync_temp
Repo sync for protected CLA branch
2 parents 3ee48ed + 1a78ed9 commit af40d68

File tree

302 files changed

+3
-862
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+3
-862
lines changed

docs/code-quality/ca2240.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ The following example fixes the two previous violations by providing an override
6969
:::code language="vb" source="../snippets/visualbasic/VS_Snippets_CodeAnalysis/FxCop.Usage.ImplementISerializableCorrectly2/vb/FxCop.Usage.ImplementISerializableCorrectly2.vb" id="Snippet1":::
7070
---
7171

72-
7372
## Related rules
7473

7574
- [CA2236: Call base class methods on ISerializable types](../code-quality/ca2236.md)

docs/code-quality/code-metrics-values.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@ The following list shows the code metrics results that Visual Studio calculates:
4141

4242
- **Class Coupling** - Measures the coupling to unique classes through parameters, local variables, return types, method calls, generic or template instantiations, base classes, interface implementations, fields defined on external types, and attribute decoration. Good software design dictates that types and methods should have high cohesion and low coupling. High coupling indicates a design that is difficult to reuse and maintain because of its many interdependencies on other types. For more information, see [Class coupling](code-metrics-class-coupling.md).
4343

44-
4544
- **Lines of Source code** - Indicates the exact number of source code lines that are present in your source file, including blank lines. This metric is available starting in Visual Studio 2019 version 16.4 and Microsoft.CodeAnalysis.Metrics (2.9.5).
4645

4746
- **Lines of Executable code** - Indicates the approximate number of executable code lines or operations. This is a count of number of operations in executable code. This metric is available starting in Visual Studio 2019 version 16.4 and Microsoft.CodeAnalysis.Metrics (2.9.5). The value is typically a close match to the previous metric, **Lines of Code**, which is the MSIL-instruction-based metric used in legacy mode.
4847

49-
5048
## Anonymous methods
5149

5250
An *anonymous method* is just a method that has no name. Anonymous methods are most frequently used to pass a code block as a delegate parameter. Code metrics results for an anonymous method that's declared in a member, such as a method or accessor, are associated with the member that declares the method. They are not associated with the member that calls the method.

docs/code-quality/disable-code-analysis.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ Examples:
108108

109109
::: moniker-end
110110

111-
112111
## See also
113112

114113
- [Suppress violations](use-roslyn-analyzers.md#suppress-violations)

docs/code-quality/how-to-configure-code-analysis-for-a-managed-code-project.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,15 @@ In Visual Studio, you can choose from a list of code analysis [rule sets](../cod
4141

4242
2. In the **Configuration** and **Platform** lists, choose the build configuration and target platform.
4343

44-
4544
3. To run code analysis every time the project is built using the selected configuration, select **Run on build** in the **Binary analyzers** section. You can also run legacy code analysis manually, see [How to: Run Legacy Code Analysis Manually for Managed Code](how-to-run-legacy-code-analysis-manually-for-managed-code.md) for more details.
4645

47-
4846
4. To view warnings from generated code, clear the **Suppress results from generated code** check box.
4947

5048
> [!NOTE]
5149
> This option does not suppress code analysis errors and warnings from generated code when the errors and warnings appear in forms and templates. You can both view and maintain the source code for a form or a template, and it won't be overwritten.
5250
53-
5451
5. In the **Active rules** list, do one of the following:
5552

56-
5753
- Select the rule set that you want to use.
5854

5955
- Select **\<Browse>** to find an existing custom rule set that is not in the list.

docs/code-quality/how-to-create-a-custom-rule-set.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ To create a custom rule set, you can open a built-in rule set in the **rule set
2929

3030
2. On the **Properties** pages, select the **Code Analysis** tab.
3131

32-
3332
3. In the **Active rules** drop-down list, do one of the following:
3433

35-
3634
- Choose the rule set that you want to customize.
3735

3836
\- or -
@@ -65,10 +63,8 @@ You can create a new rule set file from the **New File** dialog:
6563

6664
2. On the **Properties** pages, select the **Code Analysis** tab.
6765

68-
6966
3. Select **\<Choose multiple rule sets>** from **Active rules**.
7067

71-
7268
4. In the **Add or Remove Rule Sets** dialog box, choose the rule sets you want to include in your new rule set.
7369

7470
![Add or remove rule sets dialog box](media/add-remove-rule-sets.png)

docs/code-quality/how-to-enable-and-disable-automatic-code-analysis-for-managed-code.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ To enable or disable legacy code analysis:
2626

2727
3. Specify the build type in **Configuration** and the target platform in **Platform**. (Non-.NET Core/.NET Standard projects only.)
2828

29-
3029
4. To enable or disable automatic code analysis, select or clear the **Run on build** check box in the **Binary analyzers** section.
3130

3231
![Run binary code analysis on build option in Visual Studio](media/run-on-build-binary-analyzers.png)
@@ -35,6 +34,5 @@ To enable or disable legacy code analysis:
3534

3635
`<RunCodeAnalysis>false</RunCodeAnalysis>`
3736

38-
3937
> [!NOTE]
4038
> Disabling binary code analysis on build does not affect [.NET Compiler Platform-based code analyzers](roslyn-analyzers-overview.md), which always execute at build if you installed them as a NuGet package. For information about disabling analysis from these analyzers, see [How to disable source code analysis](disable-code-analysis.md).

docs/code-quality/how-to-generate-code-metrics-data.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ The results are generated and the **Code Metrics Results** window is displayed.
8888

8989
The results are generated and the **Code Metrics Results** window is displayed. To view the results details, expand the tree in the **Hierarchy**.
9090

91-
9291
## Command-line code metrics
9392

9493
You can generate code metrics data from the command line for C# and Visual Basic projects for .NET Framework, .NET Core, and .NET Standard apps. To run code metrics from the command line, install the [Microsoft.CodeAnalysis.Metrics NuGet package](#microsoftcodeanalysismetrics-nuget-package) or build the [Metrics.exe](#metricsexe) executable yourself.
@@ -146,7 +145,6 @@ Build succeeded.
146145

147146
The generated XML output takes the following format:
148147

149-
150148
```xml
151149
<?xml version="1.0" encoding="utf-8"?>
152150
<CodeMetricsReport Version="1.0">
@@ -203,7 +201,6 @@ The generated XML output takes the following format:
203201
```
204202

205203

206-
207204
### Metrics.exe
208205

209206
If you don't want to install the NuGet package, you can generate and use the *Metrics.exe* executable directly. To generate the *Metrics.exe* executable:
@@ -247,14 +244,12 @@ For more information, see [Enable generating code metrics in legacy mode](https:
247244
Visual Studio 2015 included a command-line code metrics tool that was also called *Metrics.exe*. This previous version of the tool did a binary analysis, that is, an assembly-based analysis. The newer version of the *Metrics.exe* tool analyzes source code instead. Because the newer *Metrics.exe* tool is source code-based, command-line code metrics results may be different to those generated by the Visual Studio IDE and by previous versions of *Metrics.exe*. Starting in Visual Studio 2019, the Visual Studio IDE analyzes source code like the command-line tool and the results should be the same.
248245

249246

250-
251247
The new command-line code metrics tool computes metrics even in the presence of source code errors, as long as the solution and project can be loaded.
252248

253249
#### Metric value differences
254250

255251
Starting in Visual Studio 2019 version 16.4 and Microsoft.CodeAnalysis.Metics (2.9.5), `SourceLines` and `ExecutableLines` replace the previous `LinesOfCode` metric. For descriptions of the new metrics, see [Code metrics values](../code-quality/code-metrics-values.md). The `LinesOfCode` metric is available in legacy mode.
256252

257-
258253
Other metrics such as `CyclomaticComplexity` and `MaintainabilityIndex` use the same formulas as previous versions of *Metrics.exe*, but the new tool counts the number of `IOperations` (logical source instructions) instead of intermediate language (IL) instructions. The numbers will be slightly different to those generated by the Visual Studio IDE and by previous versions of *Metrics.exe*.
259254

260255
## See also

docs/code-quality/how-to-synchronize-code-project-rule-sets-with-team-project-check-in-policy.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ You synchronize the code analysis settings for code projects to the check-in pol
3434

3535
2. Click **Code Analysis**.
3636

37-
3837
3. In the **Active rules** list, select the check-in policy rule set.
3938

40-
4139
## To specify a custom check-in policy rule set
4240

4341
1. If necessary, perform a get operation on the rule set file that specifies the check-in policy.
@@ -46,10 +44,8 @@ You synchronize the code analysis settings for code projects to the check-in pol
4644

4745
3. Click **Code Analysis**.
4846

49-
5047
4. In the **Active rules** list, click **\<Browse>**.
5148

52-
5349
5. In the **Open** dialog box, specify the check-in policy rule set file.
5450

5551
## To create a custom rule set for a code project

docs/code-quality/implementing-custom-code-analysis-check-in-policies-for-managed-code.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,8 @@ You specify a project check-in policy rule set as the code analysis rule set of
109109

110110
4. If necessary, click the appropriate options in the **Configuration** and **Platform** lists.
111111

112-
113112
5. To run code analysis every time that the code project is built using the specified configuration, select **Run on build** in the **Binary analyzers** section.
114113

115-
116114
6. In the **Run this rule set** list, click **\<Browse>**.
117115

118116
8. Select the local version of the check-in policy rule set file.

docs/code-quality/in-source-suppression-overview.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ ms.workload:
2424

2525
It is often useful to indicate that a warning is not applicable. Suppressing code analysis violations indicates team members the code was reviewed, and the warning can be suppressed. The following sections describe the different ways to suppress code analysis violations using the Visual Studio IDE.
2626

27-
2827
## Suppress violations using the EditorConfig file
2928

3029
In an **EditorConfig file**, set the severity to `none`, for example, `dotnet_diagnostic.CA1822.severity = none`. To add an EditorConfig file, see [Add an EditorConfig file to a project](../ide/create-portable-custom-editor-options.md#add-and-remove-editorconfig-files).
3130

32-
3331
## Suppress violations in source code
3432

3533
You can suppress violations in code using a preprocessor directive, the [#pragma warning (C#)](/dotnet/csharp/language-reference/preprocessor-directives#pragma-warning) or [Disable (Visual Basic)](/dotnet/visual-basic/language-reference/directives/disable-enable) directive to suppress the warning for only a specific line of code. Or, you can use the [SuppressMessage attribute](#in-source-suppression-and-the-suppressmessage-attribute).
@@ -71,11 +69,9 @@ The [global suppression file](#global-level-suppressions) uses the [SuppressMess
7169

7270
- From the **code editor**, place the cursor in the line of code with the violation and press **Quick actions and refactorings** (or press **Ctrl**+**Period (.)**) to open the **Quick Actions** menu. Select **Suppress CAXXXX**, and then choose **in Suppression File**. You see a preview of the [global suppression file](#global-level-suppressions) that will be created or modified.
7371

74-
7572
- From the **Analyze** menu, select **Analyze** > **Build and Suppress Active Issues** on the menu bar to suppress all current violations. Suppressing all current violations is sometimes referred to as "baselining".
7673

7774

78-
7975
## Suppress violations using project settings
8076

8177
From **Solution Explorer**, open the properties for the project (right-click the project and choose **Properties** (or press **Alt + Enter**) and use the **Code Analysis** tab to configure options. For example, you can disable live code analysis or disable .NET analyzers.
@@ -95,18 +91,15 @@ In C++/CLI, use the macros CA\_SUPPRESS\_MESSAGE or CA\_GLOBAL\_SUPPRESS_MESSAGE
9591
> [!NOTE]
9692
> You should not use in-source suppressions on release builds, to prevent shipping the in-source suppression metadata accidentally.
9793
98-
9994
> [!NOTE]
10095
> If you migrate a project to Visual Studio 2019, you might suddenly be faced with a large number of code analysis warnings. If you aren't ready to fix the warnings, you can suppress all of them by selecting **Analyze** > **Build and Suppress Active Issues**.
10196
102-
10397
### SuppressMessage attribute
10498

10599
When you select **Suppress** from the context or right-click menu of a code analysis warning in the **Error List**, a <xref:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute> attribute is added either in your code or to the project's global suppression file.
106100

107101
The <xref:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute> attribute has the following format:
108102

109-
110103
### [C#](#tab/csharp)
111104
```csharp
112105
[Scope:SuppressMessage("Rule Category", "Rule Id", Justification = "Justification", MessageId = "MessageId", Scope = "Scope", Target = "Target")]

docs/code-quality/install-roslyn-analyzers.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,13 @@ Visual Studio includes a core set of .NET Compiler Platform (*Roslyn*) analyzers
3636

3737
## To install VSIX analyzers
3838

39-
4039
1. In Visual Studio, select **Extensions** > **Manage Extensions**.
4140

4241
The **Manage Extensions** dialog box opens.
4342

4443
> [!NOTE]
4544
> Alternatively, you can find and download the analyzer extension directly from [Visual Studio Marketplace](https://marketplace.visualstudio.com).
4645
47-
4846
2. Expand **Online** in the left pane, and then select **Visual Studio Marketplace**.
4947

5048
3. In the search box, type the name of the analyzer extension you want to install.
@@ -65,10 +63,8 @@ Visual Studio includes a core set of .NET Compiler Platform (*Roslyn*) analyzers
6563

6664
8. Open Visual Studio again.
6765

68-
6966
If you want to check whether the extension is installed, select **Extensions** > **Manage Extensions**. In the **Manage Extensions** dialog box, select the **Installed** category on the left, and then search for the extension by name.
7067

71-
7268
## Next steps
7369

7470
> [!div class="nextstepaction"]

docs/code-quality/static-code-analysis-for-managed-code-overview.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,9 @@ Public class MyClass
5555

5656
For more information, see [Suppress warnings](../code-quality/in-source-suppression-overview.md).
5757

58-
5958
> [!NOTE]
6059
> If you migrate a project to Visual Studio 2019, you might suddenly be faced with a large number of code analysis warnings. If you aren't ready to fix the warnings, you can suppress all of them by choosing **Analyze** > **Build and Suppress Active Issues**.
6160
62-
6361
## Run code analysis as part of check-in policy
6462

6563
As an organization, you might want to require that all check-ins satisfy certain policies. In particular, you want to make sure that you follow these policies:

docs/code-quality/use-roslyn-analyzers.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ Following is the converted EditorConfig file:
245245
# Code files
246246
[*.{cs,vb}]
247247

248-
249248
dotnet_diagnostic.CA1001.severity = warning
250249

251250
dotnet_diagnostic.CA1821.severity = warning

docs/code-quality/walkthrough-analyzing-managed-code-for-code-defects.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,10 @@ This article steps you through the process of using legacy analysis to analyze y
5858

5959
3. Choose the **Code Analysis** tab.
6060

61-
6261
4. Make sure that **Run on build** is selected in the **Binary analyzers** section.
6362

6463
5. From the **Active rules** drop-down list, select **Microsoft All Rules**.
6564

66-
6765
6. On the **File** menu, click **Save Selected Items**, and then close the properties pages.
6866

6967
7. On the **Build** menu, click **Build CodeAnalysisManagedDemo**.

docs/containers/container-launch-settings.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ ms.topic: reference
1313

1414
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). In *launchSettings.json*, the settings in the **Docker** section are related to how Visual Studio handles containerized apps.
1515

16-
1716
```json
1817
"Docker": {
1918
"commandName": "Docker",
@@ -30,10 +29,8 @@ In the *Properties* folder in an ASP.NET Core project, you can find the launchSe
3029
}
3130
```
3231

33-
3432
The commandName setting identifies that this section applies to Container Tools. The following table shows the properties that can be set in this section:
3533

36-
3734
::: moniker range="vs-2019"
3835

3936
| Setting name | Example | Description |

docs/containers/container-tools-configure.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Using Visual Studio settings, you can control some aspects of how Visual Studio
1717

1818
From the main menu, choose **Tools > Options**, and expand **Container Tools > Settings**. The container tools settings appear.
1919

20-
2120
Container Tools **General** settings:
2221

2322
![Visual Studio Container Tools options, showing: Install Docker Desktop if needed, and Trust ASP.NET Core SSL certificate.](./media/configure-container-tools/tools-options-1.png)
@@ -26,10 +25,8 @@ Container Tools **Single Project** and **Docker Compose** settings:
2625

2726
![Visual Studio Container Tools options, showing: Kill containers on project close, Pull required Docker images on project open, and Run containers on project open.](./media/configure-container-tools/tools-options-2.png)
2827

29-
3028
The following table might help you decide how to set these options.
3129

32-
3330
The following table describes **General** settings:
3431

3532
| Name | Default Setting | Applies To | Description |
@@ -52,7 +49,6 @@ The **Containers Tool Window** settings control the settings that apply to the *
5249

5350
The following table describes the **Containers** window settings:
5451

55-
5652
| Name | Default Setting | Description |
5753
| -----|:---------------:| ----------- |
5854
| Confirm before pruning containers | Always | Controls whether you are prompted when pruning unused containers. |

docs/containers/container-tools-react.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ The project uses the SPA Proxy during debugging. See [Improved single-page app (
312312
ASPNETCORE_ENVIRONMENT=Development,ASPNETCORE_HOSTINGSTARTUPASSEMBLIES=Microsoft.AspNetCore.SpaProxy
313313
```
314314
315-
316315
1. Set the **URL** to `https://localhost:{proxy-port}` where `{proxy-port}` is the port from the proxy server (from step 1).
317316
318317
![Screenshot of Debug Launch Profile settings for client debugging.](./media/container-tools-react/vs-2022/launch-profiles-debugging.png)
@@ -393,7 +392,6 @@ You can also view the images and inspect information about them. Choose the **Im
393392
> [!NOTE]
394393
> The **dev** image does not contain the app binaries and other content, as **Debug** configurations use volume mounting to provide the iterative edit and debug experience. To create a production image containing all contents, use the **Release** configuration.
395394
396-
397395
## Publish Docker images
398396

399397
Once the develop and debug cycle of the app is completed, you can create a production image of the app.

docs/containers/container-tools.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ ms.topic: quickstart
1111

1212
[!INCLUDE [Visual Studio](~/includes/applies-to-version/vs-windows-only.md)]
1313

14-
1514
::: moniker range="vs-2019"
1615

1716
[!include[Visual Studio Container Tools](includes/vs-2019/container-tools.md)]

docs/containers/deploy-app-service.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ The following steps guide you through creating a basic ASP.NET Core app that wil
4747

4848
## Deploy the container to Azure
4949

50-
5150
:::moniker range="vs-2019"
5251

5352
1. Right-click your project in **Solution Explorer** and choose **Publish**.

docs/containers/edit-and-refresh.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ If you already have a project of a supported type, Visual Studio can create a Do
2525

2626
To debug apps in a local Docker container, the following tools must be installed:
2727

28-
2928
::: moniker range="vs-2019"
3029

3130
* [Visual Studio 2019](https://visualstudio.microsoft.com/downloads) with the Web Development workload installed

docs/containers/hosting-web-apps-in-docker.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ The following steps guide you through creating a basic ASP.NET Core app that wil
4545
[!INCLUDE [create-aspnet5-app](../azure/includes/vs-2022/create-aspnet5-app-2022.md)]
4646
::: moniker-end
4747

48-
4948
::: moniker range="vs-2019"
5049
## Publish your container to Azure Container Registry
5150
1. Right-click your project in **Solution Explorer** and choose **Publish**.
@@ -102,7 +101,6 @@ The following steps guide you through creating a basic ASP.NET Core app that wil
102101
6. Choose **Finish** to complete the process.
103102
::: moniker-end
104103

105-
106104
You can now pull the container from the registry to any host capable of running Docker images, for example [Azure Container Instances](/azure/container-instances/container-instances-tutorial-deploy-app).
107105

108106
## See also

docs/containers/overview.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ ms.technology: vs-container-tools
1313

1414
The tools included in Visual Studio for developing with Docker containers are easy to use, and greatly simplify building, debugging, and deployment for containerized applications. You can work with a container for a single project, or use container orchestration with Docker Compose or Service Fabric to work with multiple services in containers.
1515

16-
1716
::: moniker range="vs-2019"
1817

1918
## Prerequisites
@@ -152,7 +151,6 @@ ENTRYPOINT ["dotnet", "WebApplication-Docker.dll"]
152151

153152
:::moniker-end
154153

155-
156154
## Use the Containers window
157155

158156
The **Containers** window lets you view containers and images on your machine and see what's going on with them. You can view the filesystem, volumes mounted, environment variables, ports used, and examine log files.

0 commit comments

Comments
 (0)