You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running tests with VSTest, dotnet test is not going to fail if a project doesn't have IsTestProject set to true. This is because of the target having a condition on IsTestProject:
For MTP, if the library is setting TestingPlatformDotnetTestSupport (which is common because we want to advise users to set it in Directory.Build.props), then we will attempt to run the library as a project.
We should consider adding IsTestProject condition to InvokeTestingPlatform target.
Alternatively, we could add <TestingPlatformDotnetTestSupport Condition="'$(IsTestProject)' != 'true'">false</TestingPlatformDotnetTestSupport> after this line:
Describe the bug
When running tests with VSTest,
dotnet test
is not going to fail if a project doesn't haveIsTestProject
set to true. This is because of the target having a condition onIsTestProject
:https://github.com/microsoft/vstest/blob/4b7642501171db13c4a942fbf5dbe443dffd0fd7/src/Microsoft.TestPlatform.Build/Microsoft.TestPlatform.targets#L44
For MTP, if the library is setting
TestingPlatformDotnetTestSupport
(which is common because we want to advise users to set it in Directory.Build.props), then we will attempt to run the library as a project.We should consider adding IsTestProject condition to
InvokeTestingPlatform
target.Alternatively, we could add
<TestingPlatformDotnetTestSupport Condition="'$(IsTestProject)' != 'true'">false</TestingPlatformDotnetTestSupport>
after this line:testfx/src/Platform/Microsoft.Testing.Platform.MSBuild/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.targets
Line 237 in 9725b59
Steps To Reproduce
Run
dotnet test
on the attached solution.TestProject32.zip
Note: It works with VSTest.
Note 2: It's not a good practice that a library is referencing a test project and is usually a sign of a bad design of some sort.
Expected behavior
Actual behavior
Additional context
The text was updated successfully, but these errors were encountered: