Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ native console app example #136

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ Code coverage results: output.coverage.

For existing projects to get latest features and best performance please keep up to date below references:
```xml
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.CodeCoverage" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.CodeCoverage" Version="17.11.1" />
```

If your solution doesn't contain any C++ code it is recommended to disable native code coverage by adding into configuration below flags:
Expand Down
1 change: 1 addition & 0 deletions samples/VisualStudio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
6. [**Scenario 06** C++ code coverage in Visual Studio](scenarios/scenario06/README.md)
7. [**Scenario 07** C++ code coverage in Visual Studio ARM64](scenarios/scenario07/README.md)
8. [**Scenario 08** Static code coverage for ASP.NET Core Web App (Razor Pages) in IIS](scenarios/scenario08/README.md)
9. [**Scenario 09** C++ code coverage for Console App in Developer PowerShell for VS Enterprise](scenarios/scenario09/README.md)
29 changes: 29 additions & 0 deletions samples/VisualStudio/scenarios/scenario09/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Scenario Description

Static C++ code coverage for new Native Console App project in Visual Studio.

## Collect C++ code coverage Console App

1. Open Visual Studio Enterprise

2. Create new Native Console App project.

![alt text](create.png "Create C++ Console App Project.")

3. Enable **Profile** (Configuration Properties->Linker->Advanced) flag for all projects in solution

![alt text](profile-flag.png "Profile linker flag.")

4. Build solution

![alt text](build.png "Build solution")

5. Collect code coverage in Developer PowerShell for VS Enterprise
```console
Microsoft.CodeCoverage.Console.exe collect --include-files .\x64\Debug\** .\x64\Debug\ConsoleApplication1.exe
```
![alt text](collect.png "Collect code coverage")

6. View code coverage results

![alt text](results.png "Code coverage results.")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.