Skip to content

Commit

Permalink
Propagate native references to merged project wrapper outputs (#65592)
Browse files Browse the repository at this point in the history
When building tests in merged mode, we need to copy the native
references along with the component test dlls to the output folder
to make them discoverable by the OS loader.

Thanks

Tomas
  • Loading branch information
trylek authored Feb 19, 2022
1 parent ba72feb commit 79d478a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/tests/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@
<SkipImportILTargets Condition="'$(CLRTestBuildAllTargets)' != '' And '$(CLRTestNeedTarget)' != '$(CLRTestBuildAllTargets)'">true</SkipImportILTargets>
</PropertyGroup>

<Target Name="CopyMergedWrapperReferences"
Condition="'$(IsMergedTestRunnerAssembly)' == 'true'"
AfterTargets="Build"
BeforeTargets="CopyNativeProjectBinaries">
<ItemGroup>
<MergedWrapperReferenceFolders Include="@(ProjectReference->'$([System.IO.Path]::GetFullPath('%(ProjectReference.Identity)/..', '$(OutDir)/..'))/%(ProjectReference.FileName)')" />
<!-- For merged project wrappers, include native libraries in all project references -->
<MergedWrapperReferenceFiles Include="%(MergedWrapperReferenceFolders.Identity)/$(LibPrefix)*$(LibSuffix)" />
</ItemGroup>
<Copy SourceFiles="@(MergedWrapperReferenceFiles)"
DestinationFiles="@(MergedWrapperReferenceFiles->'$(OutDir)/%(FileName)%(Extension)')"
SkipUnchangedFiles="true"
/>
</Target>

<Target Name="CopyNativeProjectBinaries" Condition="'$(_CopyNativeProjectBinaries)' == 'true'">
<ItemGroup Condition="'$(UseVisualStudioNativeBinariesLayout)' == 'true'">
<NativeProjectBinaries Include="$(NativeProjectOutputFolder)\*.*" />
Expand Down

0 comments on commit 79d478a

Please sign in to comment.