Open
Description
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'stests
folder with a reference to that in the test'scproj
file like this:<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)ILLink.Descriptors.xml" />
- Adding a
TrimmingTests
folder to the library'stests
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.