1 <?xml version="1.0" encoding="utf-8"?>
2 <!-- This overrides the typical ResolveNuGetPackages so that it does copy local of the
3 referenced items. This is used so that we can correctly resolve and copy the libraries necessary
4 to the core_root directory -->
6 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
7 <Target Name="ResolveNuGetPackages">
9 <PrereleaseResolveNuGetPackageAssets Condition="Exists($(ProjectAssetsFile))"
10 AllowFallbackOnTargetSelection="true"
11 IncludeFrameworkReferences="false"
12 NuGetPackagesDirectory="$(PackagesDir)"
13 RuntimeIdentifier="$(TestNugetRuntimeId)"
14 ProjectLanguage="$(Language)"
15 ProjectLockFile="$(ProjectAssetsFile)"
16 TargetMonikers="$(TargetFrameworkMoniker)">
17 <Output TaskParameter="ResolvedAnalyzers" ItemName="Analyzer" />
18 <Output TaskParameter="ResolvedReferences" ItemName="Reference" />
19 <Output TaskParameter="ResolvedCopyLocalItems" ItemName="CopyLocal" />
20 </PrereleaseResolveNuGetPackageAssets>
22 <!-- We may have an indirect package reference that we want to replace with a project reference -->
24 <!-- Convert to file names so that we can intersect -->
25 <_ProjectReferenceFilenames Include="@(_ResolvedProjectReferencePaths->'%(FileName)%(Extension)')">
26 <OriginalIdentity>%(Identity)</OriginalIdentity>
27 </_ProjectReferenceFilenames>
29 <_ReferencesFileNames Include="@(Reference->'%(FileName)%(Extension)')">
30 <OriginalIdentity>%(Identity)</OriginalIdentity>
31 </_ReferencesFileNames>
33 <_CopyLocalFileNames Include="@(CopyLocal->'%(FileName)%(Extension)')">
34 <OriginalIdentity>%(Identity)</OriginalIdentity>
35 </_CopyLocalFileNames>
37 <!-- Intersect project-refs with package-refs -->
38 <_ReferenceFileNamesToRemove Include="@(_ReferencesFileNames->'%(OriginalIdentity)')" Condition="'@(_ProjectReferenceFilenames)' == '@(_ReferencesFileNames)' and '%(Identity)' != ''"/>
39 <_CopyLocalFileNamesToRemove Include="@(_CopyLocalFileNames->'%(OriginalIdentity)')" Condition="'@(_ProjectReferenceFilenames)' == '@(_CopyLocalFileNames)' and '%(Identity)' != ''"/>
41 <Reference Remove="@(_ReferenceFileNamesToRemove)" />
42 <CopyLocal Remove="@(_CopyLocalFileNamesToRemove)"/>
45 <Message Text="Excluding @(_ReferenceFileNamesToRemove);@(_CopyLocalFileNamesToRemove) from package references since the same file is provided by a project reference."
46 Condition="'@(_ReferenceFileNamesToRemove)' != '' or '@(_CopyLocalFileNamesToRemove)' != ''"/>
49 SourceFiles="@(CopyLocal)"
50 DestinationFolder="$(OutDir)"
51 SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
52 OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
53 Retries="$(CopyRetryCount)"
54 RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
55 UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
57 <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />