Skip to content

SDK 2.1.500 fails to set IsTestProject in net40 projects #1850

@livarcocc

Description

@livarcocc

From @jnm2 on November 22, 2018 16:3

Here's a full repro: DotnetTestBug.zip

Projects like this worked in all SDKs up to 2.1.500 because Microsoft.NET.Test.Sdk sets <IsTestProject>true</IsTestProject>:

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

  <PropertyGroup>
    <!-- This works in all SDK versions until 2.1.500: -->
    <TargetFramework>net40</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="NUnit" Version="3.11.0" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.11.0" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
  </ItemGroup>

</Project>

E.g. using SDK 2.1.403, you get this output for dotnet test:

Test run for C:\Users\Joseph\Desktop\DotnetTestBug\Using SDK 2.1.403\bin\Debug\net40\TestProject1.dll(.NETFramework,Version=v4.0)
Microsoft (R) Test Execution Command Line Tool Version 15.8.0
...
Test Run Successful.

Starting with SDK 2.1.500, <IsTestProject>true</IsTestProject> is no longer set. dotnet test gives:

Skipping running test for project C:\Users\Joseph\Desktop\DotnetTestBug\Using SDK 2.1.500\TestProject1.csproj. To run tests with dotnet test add "\<IsTestProject>true\<IsTestProject>" property to project file.

Note that the same <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" /> is used in both cases.
Wasn't sure if this belonged here or at https://github.com/Microsoft/vstest/issues.

Issues

  • Is it your intention to require test projects which include a net40 target to have to manually include <IsTestProject>true</IsTestProject> directly in the test csproj? Why isn't this the case for net45, since VSTest 15.9 supports net40 and net45 equally?

  • To run tests with dotnet test add "<IsTestProject>true<IsTestProject>"

    This is invalid XML. Second tag should be a closing tag: <IsTestProject>true</IsTestProject>

Copied from original issue: dotnet/sdk#2690

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions