diff --git a/docs/core/testing/unit-testing-platform-faq.md b/docs/core/testing/unit-testing-platform-faq.md new file mode 100644 index 0000000000000..7ca8ad233a777 --- /dev/null +++ b/docs/core/testing/unit-testing-platform-faq.md @@ -0,0 +1,21 @@ +--- +title: Microsoft.Testing.Platform FAQ +description: Get answers to frequently asked questions about Microsoft.Testing.Platform. +author: Evangelink +ms.author: amauryleve +ms.date: 07/09/2024 +--- + +# Microsoft.Testing.Platform FAQ + +This article contains answers to commonly asked questions about `Microsoft.Testing.Platform`. + +## error CS8892: Method 'TestingPlatformEntryPoint.Main(string[])' will not be used as an entry point because a synchronous entry point 'Program.Main(string[])' was found + +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: + +- Remove your manually defined entry point, typically `Main` method in _Program.cs_, and let testing platform to generate one for you. + +- Disable the generation of the entry point by setting `false` MSBuild property. + +- Completely disable the transitive dependency to `Microsoft.Testing.Platform.MSBuild` by setting `false` 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. diff --git a/docs/core/testing/unit-testing-platform-intro.md b/docs/core/testing/unit-testing-platform-intro.md index a8ad609880785..722a484aa09ef 100644 --- a/docs/core/testing/unit-testing-platform-intro.md +++ b/docs/core/testing/unit-testing-platform-intro.md @@ -209,6 +209,18 @@ Specifies the minimum number of tests that are expected to run. By default, at l 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. +## MSBuild integration + +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: + +- Support for `dotnet test`, see [dotnet test integration](./unit-testing-platform-integration-dotnet-test.md) for more information. +- Support for `ProjectCapability` required by `Visual Studio` and `Visual Studio Code` Test Explorers. +- Automatic generation of the entry point (`Main` method) +- Automatic generation of the configuration file + +> [!NOTE] +> 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. + ## See also - [Microsoft.Testing.Platform and VSTest comparison](unit-testing-platform-vs-vstest.md)