Skip to content

[Bug]: TUnitImplicitUsings / TUnitAssertionsImplicitUsings not respected in Directory.Build.props #5208

@Lexy2

Description

@Lexy2

Description

All test projects are configured using a single property set at the folder level in Directory.Build.props
If I want to prepare migrating it to TUnit, I want both TUnit and NUnit to be present in the projects to run code fixers.
However, the migration workaround to remove explicit usings:

<PropertyGroup>
    <TUnitImplicitUsings>false</TUnitImplicitUsings>
    <TUnitAssertionsImplicitUsings>false</TUnitAssertionsImplicitUsings>
</PropertyGroup>

doesn't work if I try to apply it in Directory.Build.props.

Expected Behavior

Projects build successfully, there are no namespace conflicts.

Actual Behavior

error CS0104: 'Test' is an ambiguous reference between 'TUnit.Core.TestAttribute' and 'NUnit.Framework.TestAttribute'

Steps to Reproduce

  1. Create NUnit test project
  2. Add TUnit to Directory.Build.props
  3. Add disabling implicit usings to Directory.Build.props
  4. Build

TUnit Version

1.20.0

.NET Version

.NET 10

Operating System

Windows

IDE / Test Runner

dotnet CLI (dotnet test / dotnet run)

Error Output / Stack Trace

error CS0104: 'Test' is an ambiguous reference between 'TUnit.Core.TestAttribute' and 'NUnit.Framework.TestAttribute'

Additional Context

Putting those properties directly into csproj files works.

IDE-Specific Issue?

  • I've confirmed this issue occurs when running via dotnet test or dotnet run, not just in my IDE

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions