Skip to content

Build error when one test project references another #3813

@bdukes

Description

@bdukes

Describe the bug

Starting with MSTest 3.6.0, when one test project references another test project, warning CS0436 is emitted by the compiler because the same type is being compiled into two assemblies.

Steps To Reproduce

  1. Pull build-error-on-reference branch from bdukes/mstest-demo
  2. dotnet build

Expected behavior

The build command is successful.

Actual behavior

The build command fails with the following error:

I:\code\MSTestDemo\ProjectTwo.Tests\obj\Debug\net8.0\TestPlatformEntryPoint.cs(13,9): warning CS0436: The type 'SelfRegi
steredExtensions' in 'I:\code\MSTestDemo\ProjectTwo.Tests\obj\Debug\net8.0\AutoRegisteredExtensions.cs' conflicts with t
he imported type 'SelfRegisteredExtensions' in 'ProjectOne.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
. Using the type defined in 'I:\code\MSTestDemo\ProjectTwo.Tests\obj\Debug\net8.0\AutoRegisteredExtensions.cs'. [I:\code
\MSTestDemo\ProjectTwo.Tests\ProjectTwo.Tests.csproj]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions