testfx icon indicating copy to clipboard operation
testfx copied to clipboard

TestingPlatformEntryPoint.Main is generated in project referencing unit test project

Open drieseng opened this issue 8 months ago • 2 comments

Describe the bug

After upgrading MSTest (V2) from version 3.1.1 to version 3.4.3, the following diagnostic is reported for one of our solutions:

error CS8892: Method 'TestingPlatformEntryPoint.Main(string[])' will not be used as an entry point because a synchronous entry point 'Program.Main(string[])' was found

This diagnostic is reported when we have a (console) project - that is not a unit test project - which references a unit test project. I don't see why such an entrypoint is generated in projects that reference a unit test project. It should only be generated in the unit test project itself.

Steps To Reproduce

  1. Clone https://github.com/drieseng/duplicate-entrypoint.git
  2. Open the DuplicateEntrypoint.sln solution in Visual Studio.
  3. Build the solution.

Expected behavior

No warnings or error are reported.

Actual behavior

The following diagnostic is reported:

error CS8892: Method 'TestingPlatformEntryPoint.Main(string[])' will not be used as an entry point because a synchronous entry point 'Program.Main(string[])' was found

drieseng avatar Jun 19 '24 11:06 drieseng