Skip to content

Unable to add trimming tests for OOB assemblies #102837

Open
@steveharter

Description

@steveharter

When trimming tests are added to an OOB assembly, such as System.Data.OleDb, the build\test command results in error messages like this due to the source assembly not being found. This is due to missing target architecture in the path:

C:\git\ComponentModel\.dotnet\sdk\9.0.100-preview.3.24204.13\Microsoft.Common.CurrentVersion.targets(4983,5): error MSB3030: Could not copy the file "C:\git\ComponentModel\artifacts\bin\System.Data.Odbc\Release\net9.0\System.Data.
Odbc.dll" because it was not found. [C:\git\ComponentModel\artifacts\bin\trimmingTests\projects\System.Data.Odbc.TrimmingTests\OdbcParameterTest\win-x64\project.csproj]

In this case, there is no net9.0 subfolder, but there is net9.0-windows, net9.0-unix, etc.

FWIW adding trimming tests include:

  • Adding a ILLink.Descriptors.xml file to the library's tests folder with a reference to that in the test's cproj file like this:
    • <TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
  • Adding a TrimmingTests folder to the library's tests folder which includes a .proj file as well as .cs files for the tests.
  • Building like this:
    • build.cmd -s libs.tests /p:TestAssemblies=false /p:TestTrimming=true

Linking #102244 for the need to add OOB trimming tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Infrastructure-librarieslinkable-frameworkIssues associated with delivering a linker friendly frameworkneeds-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions