diff options
Diffstat (limited to 'tests/xunitwrapper.targets')
-rw-r--r-- | tests/xunitwrapper.targets | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/xunitwrapper.targets b/tests/xunitwrapper.targets new file mode 100644 index 0000000000..6d5c5e2664 --- /dev/null +++ b/tests/xunitwrapper.targets @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- This overrides the typical ResolveNuGetPackages so that it does copy local of the + referenced items. This is used so that we can correctly resolve and copy the libraries necessary + to the core_root directory --> + +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Target Name="ResolveNuGetPackages"> + + <PrereleaseResolveNuGetPackageAssets Condition="Exists($(ProjectLockJson))" + AllowFallbackOnTargetSelection="true" + IncludeFrameworkReferences="false" + NuGetPackagesDirectory="$(PackagesDir)" + RuntimeIdentifier="dotnet" + ProjectLanguage="$(Language)" + ProjectLockFile="$(ProjectLockJson)" + TargetMonikers="$(TargetFrameworkMoniker)"> + <Output TaskParameter="ResolvedAnalyzers" ItemName="Analyzer" /> + <Output TaskParameter="ResolvedReferences" ItemName="Reference" /> + <Output TaskParameter="ResolvedCopyLocalItems" ItemName="CopyLocal" /> + </PrereleaseResolveNuGetPackageAssets> + + <!-- We may have an indirect package reference that we want to replace with a project reference --> + <ItemGroup> + <!-- Convert to file names so that we can intersect --> + <_ProjectReferenceFilenames Include="@(_ResolvedProjectReferencePaths->'%(FileName)%(Extension)')"> + <OriginalIdentity>%(Identity)</OriginalIdentity> + </_ProjectReferenceFilenames> + + <_ReferencesFileNames Include="@(Reference->'%(FileName)%(Extension)')"> + <OriginalIdentity>%(Identity)</OriginalIdentity> + </_ReferencesFileNames> + + <_CopyLocalFileNames Include="@(CopyLocal->'%(FileName)%(Extension)')"> + <OriginalIdentity>%(Identity)</OriginalIdentity> + </_CopyLocalFileNames> + + <!-- Intersect project-refs with package-refs --> + <_ReferenceFileNamesToRemove Include="@(_ReferencesFileNames->'%(OriginalIdentity)')" Condition="'@(_ProjectReferenceFilenames)' == '@(_ReferencesFileNames)' and '%(Identity)' != ''"/> + <_CopyLocalFileNamesToRemove Include="@(_CopyLocalFileNames->'%(OriginalIdentity)')" Condition="'@(_ProjectReferenceFilenames)' == '@(_CopyLocalFileNames)' and '%(Identity)' != ''"/> + + <Reference Remove="@(_ReferenceFileNamesToRemove)" /> + <CopyLocal Remove="@(_CopyLocalFileNamesToRemove)"/> + </ItemGroup> + + <Message Text="Excluding @(_ReferenceFileNamesToRemove);@(_CopyLocalFileNamesToRemove) from package references since the same file is provided by a project reference." + Condition="'@(_ReferenceFileNamesToRemove)' != '' or '@(_CopyLocalFileNamesToRemove)' != ''"/> + + <Copy + SourceFiles="@(CopyLocal)" + DestinationFolder="$(OutDir)" + SkipUnchangedFiles="$(SkipCopyUnchangedFiles)" + OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" + Retries="$(CopyRetryCount)" + RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" + UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"> + + <Output TaskParameter="DestinationFiles" ItemName="FileWrites" /> + </Copy> + + </Target> +</Project> |