Project falsy detected as TestProject with <ProjectCapability Remove="TestContainer"/>

We have projects with an Item Group like:

  <ItemGroup>
    <ProjectCapability Remove="TestContainer" />
  </ItemGroup>

Unfortunately this code will lead to detect the project as a Test project.

I understand that using this syntax will detect the project as a Test project:

<ProjectCapability Include="TestContainer" />

However in our case, we used the Remove="TestContainer" syntax. Is it normal it is considered as a Test project as well?

Hi @asbin - apologies for the delayed response.

I’ve just tried analysing the project file with v5.3.1 of the scanner, and it correctly identified the project as non-test code:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <ProjectCapability Include="TestContainer" />
    <ProjectCapability Remove="TestContainer" />
  </ItemGroup>

</Project>

There are other reasons why the project could be categorised as a test project, and it will be logged in the normal verbosity build output. See this wiki page for more information.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.