vtest.console.exe does not find any C++ test in test project Visual Studio 2022 (did in 2019)
I have a solution of 52 projects mixed with C#, MFC and C++/CLI working with Visual Studio 2019. Recently I retargeted it to Visual Studio 2022 and moved all C++ projects to C++20. This solution has two test projects: one .NET only and a second one (the main one) native (but some code is C++/CLI). Both are DLL. Visual Studio is 17.3.3.
In VS2019, the test framework detected all tests without problem, but VS2022 does not detect any test. Manually running the tests: vstest.console.exe .\PolarisUnitTests.dll /Platform:x86 /diag:diag.txt, returns:
Microsoft (R) Test Execution Command Line Tool Version 17.3.0-preview-20220626-01 (x64)
Copyright (c) Microsoft Corporation. All rights reserved.Starting test execution, please wait...
Logging Vstest Diagnostics in file: D:\src\software\Polaris\testing\Debug\diag.txt
A total of 1 test files matched the specified pattern.
No test is available in D:\src\software\Polaris\testing\Debug.\PolarisUnitTests.dll. Make sure that test discoverer & executors are registered and > platform & framework version settings are appropriate and try again.Additionally, path to test adapters can be specified using /TestAdapterPath command. Example /TestAdapterPath:<pathToCustomAdapters>.
Generated logs do not contain any errors. The problem is that Test Framework does not find any test into the DLL. Running this DLL with Command Line Test Tool v. 16.11.0 still does not find any test, then I assume the issue is in the compiler/linker not putting the right metadata.
Any idea how to resolve this? Thanks.