Skip to content

Commit 0f7411c

Browse files
author
JiayueHu
authored
Merge pull request #3814 from MicrosoftDocs/master
Daily publishing Feb.4
2 parents 612f8c2 + 87a6171 commit 0f7411c

File tree

45 files changed

+358
-152
lines changed

Some content is hidden

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

45 files changed

+358
-152
lines changed

.openpublishing.redirection.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7131,6 +7131,32 @@
71317131
"source_path": "docs/ide/whats-new-visual-studio.md",
71327132
"redirect_url": "/visualstudio/ide/whats-new-visual-studio-2019",
71337133
"redirect_document_id": true
7134+
},
7135+
{
7136+
"source_path": "docs/docker/vs-azure-tools-docker-edit-and-refresh.md",
7137+
"redirect_url": "/visualstudio/containers/vs-azure-tools-docker-edit-and-refresh",
7138+
"redirect_document_id": true
7139+
},
7140+
{
7141+
"source_path": "docs/docker/docker-tools.md",
7142+
"redirect_url": "/visualstudio/containers/docker-tools",
7143+
"redirect_document_id": true
7144+
},
7145+
{
7146+
"source_path": "docs/docker/vs-azure-tools-docker-hosting-web-apps-in-docker.md",
7147+
"redirect_url": "/visualstudio/containers/vs-azure-tools-docker-hosting-web-apps-in-docker",
7148+
"redirect_document_id": true
7149+
},
7150+
{
7151+
"source_path": "docs/docker/vs-azure-tools-docker-setup.md",
7152+
"redirect_url": "/visualstudio/containers/vs-azure-tools-docker-setup",
7153+
"redirect_document_id": true
7154+
},
7155+
{
7156+
"source_path": "docs/docker/vs-azure-tools-docker-troubleshooting-docker-errors.md",
7157+
"redirect_url": "/visualstudio/containers/vs-azure-tools-docker-troubleshooting-docker-errors",
7158+
"redirect_document_id": true
71347159
}
7160+
71357161
]
71367162
}

docs/code-quality/annotating-locking-behavior.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ To avoid concurrency bugs in your multithreaded program, always follow an approp
100100
|`_Interlocked_operand_`|The annotated function parameter is the target operand of one of the various Interlocked functions. Those operands must have specific additional properties.|
101101
|`_Write_guarded_by_(expr)`|Annotates a variable and indicates that whenever the variable is modified, the lock count of the lock object that's named by `expr` is at least one.|
102102

103+
104+
## Smart Lock and RAII Annotations
105+
Smart locks typically wrap native locks and manage their lifetime. The following table lists annotations that can be used with smart locks and RAII coding patterns with support for `move` semantics.
106+
107+
|Annotation|Description|
108+
|----------------|-----------------|
109+
|`_Analysis_assume_smart_lock_acquired_`|Tells the analyzer to assume that a smart lock has been acquired. This annotation expects a reference lock type as its parameter.|
110+
|`_Analysis_assume_smart_lock_released_`|Tells the analyzer to assume that a smart lock has been released. This annotation expects a reference lock type as its parameter.|
111+
|`_Moves_lock_(target, source)`|Describes `move constructor` operation which transfers lock state from the `source` object to the `target`. The `target` is considered a newly constructed object, so any state it had before is lost and replaced by the `source` state. The `source` is also reset to a clean state with no lock counts or aliasing target, but aliases pointing to it remain unchanged.|
112+
|`_Replaces_lock_(target, source)`|Describes `move assignment operator` semantics where the target lock is released before transferring the state from the source. This can be regarded as a combination of `_Moves_lock_(target, source)` preceded by a `_Releases_lock_(target)`.|
113+
|`_Swaps_locks_(left, right)`|Describes the standard `swap` behavior which assumes that objects `left` and `right` exchange their state. The state exchanged includes lock count and aliasing target, if present. Aliases that point to the `left` and `right` objects remain unchanged.|
114+
|`_Detaches_lock_(detached, lock)`|Describes a scenario in which a lock wrapper type allows dissociation with its contained resource. This is similar to how `std::unique_ptr` works with its internal pointer: it allows programmers to extract the pointer and leave its smart pointer container in a clean state. Similar logic is supported by `std::unique_lock` and can be implemented in custom lock wrappers. The detached lock retains its state (lock count and aliasing target, if any), while the wrapper is reset to contain zero lock count and no aliasing target, while retaining its own aliases. There's no operation on lock counts (releasing and acquiring). This annotation behaves exactly as `_Moves_lock_` except that the detached argument should be `return` rather than `this`.|
115+
103116
## See Also
104117

105118
- [Using SAL Annotations to Reduce C/C++ Code Defects](../code-quality/using-sal-annotations-to-reduce-c-cpp-code-defects.md)

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

Lines changed: 81 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -43,46 +43,58 @@ The results are generated and the **Code Metrics Results** window is displayed.
4343

4444
## Command-line code metrics
4545

46-
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. The command line code metrics tools is called *Metrics.exe*.
46+
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.
4747

48-
To obtain the *Metrics.exe* executable, you must [generate it yourself](#generate-the-executable). In the near future, a [published version of *Metrics.exe* will be available](https://github.com/dotnet/roslyn-analyzers/issues/1756) so you don't have to build it yourself.
48+
### Microsoft.CodeAnalysis.Metrics NuGet package
4949

50-
### Generate the executable
50+
The easiest way to generate code metrics data from the command line is by installing the [Microsoft.CodeAnalysis.Metrics](https://www.nuget.org/packages/Microsoft.CodeAnalysis.Metrics/) NuGet package. After you've installed the package, run `msbuild /t:Metrics` from the directory that contains your project file. For example:
5151

52-
To generate the executable *Metrics.exe*, follow these steps:
53-
54-
1. Clone the [dotnet/roslyn-analyzers](https://github.com/dotnet/roslyn-analyzers) repo.
55-
2. Open Developer Command Prompt for Visual Studio as an administrator.
56-
3. From the root of the **roslyn-analyzers** repo, execute the following command: `Restore.cmd`
57-
4. Change directory to *src\Tools*.
58-
5. Execute the following command to build the **Metrics.csproj** project:
59-
60-
```shell
61-
msbuild /m /v:m /p:Configuration=Release Metrics.csproj
62-
```
63-
64-
An executable named *Metrics.exe* is generated in the *artifacts\bin* directory under the repo root.
65-
66-
> [!TIP]
67-
> To build *Metrics.exe* in [legacy mode](#legacy-mode), execute the following command:
68-
>
69-
> ```shell
70-
> msbuild /m /v:m /t:rebuild /p:LEGACY_CODE_METRICS_MODE=true Metrics.csproj
71-
> ```
72-
73-
### Usage
52+
```shell
53+
C:\source\repos\ClassLibrary3\ClassLibrary3>msbuild /t:Metrics
54+
Microsoft (R) Build Engine version 16.0.360-preview+g9781d96883 for .NET Framework
55+
Copyright (C) Microsoft Corporation. All rights reserved.
56+
57+
Build started 1/22/2019 4:29:57 PM.
58+
Project "C:\source\repos\ClassLibrary3\ClassLibrary3\ClassLibrary3.csproj" on node 1 (Metrics target(s))
59+
.
60+
Metrics:
61+
C:\source\repos\ClassLibrary3\packages\Microsoft.CodeMetrics.2.6.4-ci\build\\..\Metrics\Metrics.exe /project:C:\source\repos\ClassLibrary3\ClassLibrary3\ClassLibrary3.csproj /out:ClassLibrary3.Metrics.xml
62+
Loading ClassLibrary3.csproj...
63+
Computing code metrics for ClassLibrary3.csproj...
64+
Writing output to 'ClassLibrary3.Metrics.xml'...
65+
Completed Successfully.
66+
Done Building Project "C:\source\repos\ClassLibrary3\ClassLibrary3\ClassLibrary3.csproj" (Metrics target(s)).
67+
68+
Build succeeded.
69+
0 Warning(s)
70+
0 Error(s)
71+
```
7472

75-
To run *Metrics.exe*, supply a project or solution and an output XML file as arguments. For example:
73+
You can override the output file name by specifying `/p:MetricsOutputFile=<filename>`. You can also get [legacy-style](#previous-versions) code metrics data by specifying `/p:LEGACY_CODE_METRICS_MODE=true`. For example:
7674

7775
```shell
78-
C:\>Metrics.exe /project:ConsoleApp20.csproj /out:report.xml
79-
Loading ConsoleApp20.csproj...
80-
Computing code metrics for ConsoleApp20.csproj...
81-
Writing output to 'report.xml'...
82-
Completed Successfully.
76+
C:\source\repos\ClassLibrary3\ClassLibrary3>msbuild /t:Metrics /p:LEGACY_CODE_METRICS_MODE=true /p:MetricsOutputFile="Legacy.xml"
77+
Microsoft (R) Build Engine version 16.0.360-preview+g9781d96883 for .NET Framework
78+
Copyright (C) Microsoft Corporation. All rights reserved.
79+
80+
Build started 1/22/2019 4:31:00 PM.
81+
The "MetricsOutputFile" property is a global property, and cannot be modified.
82+
Project "C:\source\repos\ClassLibrary3\ClassLibrary3\ClassLibrary3.csproj" on node 1 (Metrics target(s))
83+
.
84+
Metrics:
85+
C:\source\repos\ClassLibrary3\packages\Microsoft.CodeMetrics.2.6.4-ci\build\\..\Metrics.Legacy\Metrics.Legacy.exe /project:C:\source\repos\ClassLibrary3\ClassLibrary3\ClassLibrary3.csproj /out:Legacy.xml
86+
Loading ClassLibrary3.csproj...
87+
Computing code metrics for ClassLibrary3.csproj...
88+
Writing output to 'Legacy.xml'...
89+
Completed Successfully.
90+
Done Building Project "C:\source\repos\ClassLibrary3\ClassLibrary3\ClassLibrary3.csproj" (Metrics target(s)).
91+
92+
Build succeeded.
93+
0 Warning(s)
94+
0 Error(s)
8395
```
8496

85-
### Output
97+
### Code metrics output
8698

8799
The generated XML output takes the following format:
88100

@@ -118,7 +130,7 @@ The generated XML output takes the following format:
118130
<Metric Name="LinesOfCode" Value="7" />
119131
</Metrics>
120132
<Members>
121-
<Method Name="void Program.Main(string[] args)" File="C:\Users\mavasani\source\repos\ConsoleApp20\ConsoleApp20\Program.cs" Line="7">
133+
<Method Name="void Program.Main(string[] args)" File="C:\source\repos\ConsoleApp20\ConsoleApp20\Program.cs" Line="7">
122134
<Metrics>
123135
<Metric Name="MaintainabilityIndex" Value="100" />
124136
<Metric Name="CyclomaticComplexity" Value="1" />
@@ -137,28 +149,56 @@ The generated XML output takes the following format:
137149
</CodeMetricsReport>
138150
```
139151

140-
### Tool differences
152+
### Metrics.exe
141153

142-
Previous versions of Visual Studio, including Visual Studio 2015, included a command-line code metrics tool called *Metrics.exe*. This previous version of the tool did a binary analysis, that is, an assembly-based analysis. The new tool analyzes source code instead. Because the new *Metrics.exe* is source code-based, the results are different to what's generated by previous versions of *Metrics.exe* and within the Visual Studio 2017 IDE.
154+
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:
143155

144-
The new *Metrics.exe* tool can compute metrics even in the presence of source code errors, as long as the solution and project can be loaded.
156+
1. Clone the [dotnet/roslyn-analyzers](https://github.com/dotnet/roslyn-analyzers) repo.
157+
2. Open Developer Command Prompt for Visual Studio as an administrator.
158+
3. From the root of the **roslyn-analyzers** repo, execute the following command: `Restore.cmd`
159+
4. Change directory to *src\Tools*.
160+
5. Execute the following command to build the **Metrics.csproj** project:
145161

146-
#### Metric value differences
162+
```shell
163+
msbuild /m /v:m /p:Configuration=Release Metrics.csproj
164+
```
147165

148-
The `LinesOfCode` metric is more accurate and reliable in the new *Metrics.exe*. It is independent of any codegen differences and doesn’t change when the toolset or runtime changes. The new *Metrics.exe* counts actual lines of code, including blank lines and comments.
166+
An executable named *Metrics.exe* is generated in the *artifacts\bin* directory under the repo root.
167+
168+
#### Metrics.exe usage
169+
170+
To run *Metrics.exe*, supply a project or solution and an output XML file as arguments. For example:
149171

150-
Other metrics such as `CyclomaticComplexity` and `MaintainabilityIndex` use the same formulas as previous versions of *Metrics.exe*, but the new *Metrics.exe* counts the number of `IOperations` (logical source instructions) instead of intermediate language (IL) instructions. The numbers will be slightly different from previous versions of *Metrics.exe* and from the Visual Studio 2017 IDE code metrics results.
172+
```shell
173+
C:\>Metrics.exe /project:ConsoleApp20.csproj /out:report.xml
174+
Loading ConsoleApp20.csproj...
175+
Computing code metrics for ConsoleApp20.csproj...
176+
Writing output to 'report.xml'...
177+
Completed Successfully.
178+
```
151179

152-
### Legacy mode
180+
#### Legacy mode
153181

154-
You can also choose to build *Metrics.exe* in *legacy mode*. The legacy mode version of the tool generates metric values that are closer to what older versions of the tool generated. Additionally, in legacy mode, *Metrics.exe* generates code metrics for the same set of method types that previous versions of the tool generated code metrics for. For example, it doesn't generate code metrics data for field and property initializers. Legacy mode is useful for backwards compatibility or if you have code check-in gates based on code metrics numbers. The command to build *Metrics.exe* in legacy mode is:
182+
You can choose to build *Metrics.exe* in *legacy mode*. The legacy mode version of the tool generates metric values that are closer to what [older versions of the tool generated](#previous-versions). Additionally, in legacy mode, *Metrics.exe* generates code metrics for the same set of method types that previous versions of the tool generated code metrics for. For example, it doesn't generate code metrics data for field and property initializers. Legacy mode is useful for backwards compatibility or if you have code check-in gates based on code metrics numbers. The command to build *Metrics.exe* in legacy mode is:
155183

156184
```shell
157185
msbuild /m /v:m /t:rebuild /p:LEGACY_CODE_METRICS_MODE=true Metrics.csproj
158186
```
159187

160188
For more information, see [Enable generating code metrics in legacy mode](https://github.com/dotnet/roslyn-analyzers/pull/1841).
161189

190+
### Previous versions
191+
192+
Previous versions of Visual Studio, including 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 new tool analyzes source code instead. Because the new command-line code metrics tool is source code-based, the results are different to what's generated by previous versions of *Metrics.exe* and within the Visual Studio 2017 IDE.
193+
194+
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.
195+
196+
#### Metric value differences
197+
198+
The `LinesOfCode` metric is more accurate and reliable in the new command-line code metrics tool. It's independent of any codegen differences and doesn’t change when the toolset or runtime changes. The new tool counts actual lines of code, including blank lines and comments.
199+
200+
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 from previous versions of *Metrics.exe* and from the Visual Studio 2017 IDE code metrics results.
201+
162202
## See also
163203

164204
- [Use the Code Metrics Results window](../code-quality/working-with-code-metrics-data.md)

docs/docker/breadcrumb/toc.yml renamed to docs/containers/breadcrumb/toc.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
tocHref: /visualstudio/
77
topicHref: /visualstudio/
88
items:
9-
- name: Visual Studio Tools for Docker
10-
tocHref: /visualstudio/docker
11-
topicHref: /visualstudio/docker/
9+
- name: Visual Studio Container Tools
10+
tocHref: /visualstudio/containers
11+
topicHref: /visualstudio/containers/
1212

docs/containers/docker-tools.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: Visual Studio Tools for Docker with ASP.NET Core
3+
author: ghogen
4+
description: Learn how to use Visual Studio 2017 tooling and Docker for Windows
5+
ms.author: ghogen
6+
ms.date: 02/01/2019
7+
ms.prod: visual-studio-dev15
8+
ms.technology: vs-azure
9+
ms.topic: include
10+
---
11+
# Quickstart: Visual Studio Tools for Docker
12+
13+
::: moniker range="vs-2017"
14+
15+
[!include[Visual Studio Docker Tools](includes/vs-2017/docker-tools.md)]
16+
17+
::: moniker-end
18+
19+
::: moniker range=">= vs-2019"
20+
21+
[!include[Visual Studio Docker Tools](includes/vs-2019/docker-tools.md)]
22+
23+
::: moniker-end
24+
25+
## Additional resources
26+
27+
* [Container development with Visual Studio](/visualstudio/containers)
28+
* [Troubleshoot Visual Studio 2017 development with Docker](vs-azure-tools-docker-troubleshooting-docker-errors.md)
29+
* [Visual Studio Tools for Docker GitHub repository](https://github.com/Microsoft/DockerTools)
30+
31+
[0]:media/vs-azure-tools-docker-hosting-web-apps-in-docker/vs-acr-provisioning-dialog.png

docs/docker/docker-tools.md renamed to docs/containers/includes/vs-2017/docker-tools.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@ title: Visual Studio Tools for Docker with ASP.NET Core
33
author: ghogen
44
description: Learn how to use Visual Studio 2017 tooling and Docker for Windows
55
ms.author: ghogen
6-
ms.date: 12/17/2018
6+
ms.date: 02/01/2019
77
ms.prod: visual-studio-dev15
88
ms.technology: vs-azure
9+
ms.topic: include
910
---
10-
# Quickstart: Visual Studio Tools for Docker
1111

12-
With Visual Studio 2017, you can easily build, debug, and run containerized ASP.NET Core apps and publish them to Azure Container Registry (ACR), Docker Hub, Azure App Service, or your own container registry. In this article, we'll publish to ACR.
12+
With Visual Studio, you can easily build, debug, and run containerized ASP.NET Core apps and publish them to Azure Container Registry (ACR), Docker Hub, Azure App Service, or your own container registry. In this article, we'll publish to ACR.
1313

1414
## Prerequisites
1515

1616
* [Docker Desktop](https://hub.docker.com/editions/community/docker-ce-desktop-windows)
1717
* [Visual Studio 2017](https://visualstudio.microsoft.com/) with the **Web Development**, **Azure Tools** workload, and/or **.NET Core cross-platform development** workload installed
18+
* To publish to Azure Container Registry, an Azure subscription. [Sign up for a free trial](https://azure.microsoft.com/en-us/offers/ms-azr-0044p/).
1819

1920
## Installation and setup
2021

@@ -29,7 +30,7 @@ For Docker installation, first review the information at [Docker Desktop for Win
2930
1. Select **Web Application**.
3031
1. Check the **Enable Docker Support** checkbox.
3132

32-
![Enable Docker Support check box](media/docker-tools/enable-docker-support.PNG)
33+
![Enable Docker Support check box](../../media/docker-tools/enable-docker-support.PNG)
3334

3435
1. Select the type of container you want (Windows or Linux) and click **OK**.
3536

@@ -112,12 +113,14 @@ Once the develop and debug cycle of the app is completed, you can create a produ
112113

113114
1. Click **Create**
114115

116+
## Next steps
117+
115118
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).
116119

117120
## Additional resources
118121

119122
* [Container development with Visual Studio](/visualstudio/containers)
120-
* [Troubleshoot Visual Studio 2017 development with Docker](vs-azure-tools-docker-troubleshooting-docker-errors.md)
123+
* [Troubleshoot Visual Studio 2017 development with Docker](../../vs-azure-tools-docker-troubleshooting-docker-errors.md)
121124
* [Visual Studio Tools for Docker GitHub repository](https://github.com/Microsoft/DockerTools)
122125

123-
[0]:media/vs-azure-tools-docker-hosting-web-apps-in-docker/vs-acr-provisioning-dialog.png
126+
[0]:../../media/vs-azure-tools-docker-hosting-web-apps-in-docker/vs-acr-provisioning-dialog.png

0 commit comments

Comments
 (0)