You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/test/microsoft-code-coverage-console-tool.md
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Microsoft.CodeCoverage.Console tool
3
3
description: Use the Microsoft.CodeCoverage.Console tool to collect code coverage for C++ and C# code in nontest scenarios, and merge and convert code coverage reports.
4
-
ms.date: 09/16/2024
4
+
ms.date: 01/28/2025
5
5
ms.topic: conceptual
6
6
ms.author: mikejo
7
7
manager: mijacobs
@@ -11,15 +11,21 @@ monikerRange: '>= vs-2022'
11
11
---
12
12
# Microsoft.CodeCoverage.Console tool
13
13
14
-
Microsoft.CodeCoverage.Console is a command-line tool. You can use it to collect code coverage for C++ and C# code. It supports also merging and converting code coverage reports. This tool can be used to collect code coverage in non-test scenarios (for example, for a simple console application).
14
+
Microsoft.CodeCoverage.Console is a command-line tool that you can use to collect code coverage for C++ and C# code. It also supports merging and converting code coverage reports. This tool can be used to collect code coverage in non-test scenarios (for example, for a simple console application).
15
15
16
-
Microsoft.CodeCoverage.Console is available in Visual Studio 2022 17.3 under the folder `Common7\IDE\Extensions\Microsoft\CodeCoverage.Console`. You can use it in a Developer Command Prompt and a Developer PowerShell:
16
+
This tool is an extension to the [dotnet-coverage](/dotnet/core/additional-tools/dotnet-coverage) dotnet tool that adds support for the following scenarios:
17
+
18
+
- Adds security features to enable collecting ASP.NET code coverage data from IIS.
19
+
- Collecting code coverage for C++ code.
17
20
18
21
>[!NOTE]
19
22
> The tool is available only with Visual Studio Enterprise. For .NET code coverage, you can alternatively use the command-line tool, [dotnet-coverage](/dotnet/core/additional-tools/dotnet-coverage).
20
23
24
+
Microsoft.CodeCoverage.Console is available in Visual Studio 2022 17.3 under the folder `Common7\IDE\Extensions\Microsoft\CodeCoverage.Console`. You can use it in a Developer Command Prompt and a Developer PowerShell:
## Collect, connect, shutdown, merge, snapshot, and uninstrument commands
45
51
46
-
The Microsoft.CodeCoverage.Console tool is extension to the [dotnet-coverage](/dotnet/core/additional-tools/dotnet-coverage) dotnet tool. The documentation for collect, connect, shutdown, merge, snapshot, and uninstrument commands can be found [here](/dotnet/core/additional-tools/dotnet-coverage).
52
+
The Microsoft.CodeCoverage.Console tool is an extension to the [dotnet-coverage](/dotnet/core/additional-tools/dotnet-coverage) dotnet tool. The documentation for collect, connect, shutdown, merge, snapshot, and uninstrument commands can be found [here](/dotnet/core/additional-tools/dotnet-coverage).
47
53
48
54
Microsoft.CodeCoverage.Console supports additional security features to enable collecting ASP.NET code coverage data from IIS. Additionally, the Microsoft.CodeCoverage.Console tool supports collecting code coverage for C++ code. The `instrument` command is specific to these scenarios.
Sets the path to the XML code coverage settings. The settings file can be used to exclude some modules or methods from code coverage analysis. The format is the same as the data collector configuration inside a *.runsettings* file. For more information, see [Customize code coverage analysis](../test/customizing-code-coverage-analysis.md).
### Code coverage using collect command with configuration file
117
+
### Code coverage using collect command with configuration file (C++)
112
118
113
119
If you don't want to use the `instrument` command, you can instead use a configuration file to specify the files to instrument, as follows:
114
120
@@ -129,7 +135,9 @@ Hello World!
129
135
Code coverage results: output.coverage.
130
136
```
131
137
132
-
### Code coverage using instrument and collect commands
138
+
The settings file can be used to exclude some modules or methods from code coverage analysis. The format is the same as the data collector configuration inside a *.runsettings* file. For more information, see [Customize code coverage analysis](../test/customizing-code-coverage-analysis.md).
139
+
140
+
### Code coverage using instrument and collect commands (C++)
133
141
134
142
Before collecting code coverage data, first instrument the binary as follows:
135
143
@@ -147,7 +155,7 @@ Hello World!
147
155
Code coverage results: output.coverage.
148
156
```
149
157
150
-
### Code coverage using instrument command and collect command in server mode
158
+
### Code coverage using instrument command and collect command in server mode (C++)
151
159
152
160
Using this method, you can separate code coverage collection from running your application. First, instrument your binary as follows:
0 commit comments