Skip to content

Commit 2602e80

Browse files
EvangelinknohwndIEvangelist
authored
Add info about Microsoft.Testing.Platform.MSBuild and FAQ (#41680)
Co-authored-by: Jakub Jareš <[email protected]> Co-authored-by: David Pine <[email protected]>
1 parent 406c195 commit 2602e80

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: Microsoft.Testing.Platform FAQ
3+
description: Get answers to frequently asked questions about Microsoft.Testing.Platform.
4+
author: Evangelink
5+
ms.author: amauryleve
6+
ms.date: 07/09/2024
7+
---
8+
9+
# Microsoft.Testing.Platform FAQ
10+
11+
This article contains answers to commonly asked questions about `Microsoft.Testing.Platform`.
12+
13+
## error CS8892: Method 'TestingPlatformEntryPoint.Main(string[])' will not be used as an entry point because a synchronous entry point 'Program.Main(string[])' was found
14+
15+
Manually defining an entry point (`Main`) in test project, or referencing a test project into an application that already has an entry point, will result in conflict with the entry point generated by `Microsoft.Testing.Platform`. To avoid this issue take one of these steps:
16+
17+
- Remove your manually defined entry point, typically `Main` method in _Program.cs_, and let testing platform to generate one for you.
18+
19+
- Disable the generation of the entry point by setting `<GenerateTestingPlatformEntryPoint>false</GenerateTestingPlatformEntryPoint>` MSBuild property.
20+
21+
- Completely disable the transitive dependency to `Microsoft.Testing.Platform.MSBuild` by setting `<IsTestingPlatformApplication>false</IsTestingPlatformApplication>` MSBuild property. This is needed when you are referencing test project from a non-test project, for example: You have a console application referencing a test application.

docs/core/testing/unit-testing-platform-intro.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,18 @@ Specifies the minimum number of tests that are expected to run. By default, at l
209209

210210
The directory where the test results are going to be placed. If the specified directory doesn't exist, it's created. The default is `TestResults` in the directory that contains the test application.
211211

212+
## MSBuild integration
213+
214+
The NuGet package [Microsoft.Testing.Platform.MSBuild](https://www.nuget.org/packages/Microsoft.Testing.Platform.MSBuild) provides various integrations for `Microsoft.Testing.Platform` with MSBuild:
215+
216+
- Support for `dotnet test`, see [dotnet test integration](./unit-testing-platform-integration-dotnet-test.md) for more information.
217+
- Support for `ProjectCapability` required by `Visual Studio` and `Visual Studio Code` Test Explorers.
218+
- Automatic generation of the entry point (`Main` method)
219+
- Automatic generation of the configuration file
220+
221+
> [!NOTE]
222+
> This integration works in a transitive way (a project that references another project referencing this package will behave as if it references the package) and can be disabled through the `IsTestingPlatformApplication` MSBuild property.
223+
212224
## See also
213225

214226
- [Microsoft.Testing.Platform and VSTest comparison](unit-testing-platform-vs-vstest.md)

0 commit comments

Comments
 (0)