Skip to content

FileNotFoundException for Microsoft.Testing.Platform.dll using EnableMSTestRunner with netstandard2.0 #3984

@jeremy-visionaid

Description

@jeremy-visionaid

Describe the bug

Microsoft.Testing.Platform.dll, etc. are not being copied to the output directory via _CopyFilesMarkedCopyLocal when targeting netstandard2.0

Steps To Reproduce

Add multi-targeting to a test project like so:

  <PropertyGroup>
    <TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
    <OutputType>Exe</OutputType>

    <IsPackable>false</IsPackable>
    <IsTestProject>true</IsTestProject>
    <EnableMSTestRunner>true</EnableMSTestRunner>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
    <PackageReference Include="MSTest" Version="3.6.2" />
  </ItemGroup>

Expected behavior

Tests can be run via Test Explorer and/or running the test binary

Actual behavior

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Testing.Platform, Version=1.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
   at TestingPlatformEntryPoint.Main(String[] args)
   at TestingPlatformEntryPoint.<Main>(String[] args)

Additional context

It appears to work OK for net6.0 and net8.0...

MSTest v3.6.2 (UTC 30/10/2024) [win-x64 - .NET 8.0.10]
...

Metadata

Metadata

Assignees

Labels

Area: MTPBelongs to the Microsoft.Testing.Platform core library

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions