|
86 | 86 | </ItemGroup>
|
87 | 87 |
|
88 | 88 | <!--
|
89 |
| - Turn Reference items into a ProjectReference when UseProjectReferences is true. Order matters; this |
90 |
| - comes before package resolution because projects should be used when possible instead of packages. |
| 89 | + Turn Reference items into a ProjectReference when UseProjectReferences is true. Order matters; this |
| 90 | + comes before package resolution because projects should be used when possible instead of packages. |
91 | 91 | -->
|
92 | 92 | <ItemGroup Condition=" '$(EnableCustomReferenceResolution)' == 'true' AND '$(UseProjectReferences)' == 'true' ">
|
93 |
| - <!-- Copy then Update / Copy to intersect the ProjectReferenceProvider and Reference item groups. --> |
94 |
| - <_AllProjectReference Include="@(ProjectReferenceProvider)" /> |
95 |
| - |
96 |
| - <!-- Use only Reference items when project is a reference provider. Simplifies project moves and shortens files. --> |
97 |
| - <_AllProjectReference Update="@(ProjectReference->'%(Filename)')" DirectUse="1" /> |
98 |
| - |
99 |
| - <_AllProjectReference Update="@(Reference)" Use="1"> |
100 |
| - <!-- |
101 |
| - Metadata list is long because (a) Update defaults to copying no metadata and (b) ProjectReference metadata |
102 |
| - may include (real) Reference metadata and MSBuild task parameters. Even so, the list below is not exhaustive. |
103 |
| - --> |
104 |
| - <Aliases>%(Reference.Aliases)</Aliases> |
105 |
| - <BuildInParallel>%(Reference.BuildInParallel)</BuildInParallel> |
106 |
| - <DoNotHarvest>%(Reference.DoNotHarvest)</DoNotHarvest> |
107 |
| - <ExcludeAssets>%(Reference.ExcludeAssets)</ExcludeAssets> |
108 |
| - <IncludeAssets>%(Reference.IncludeAssets)</IncludeAssets> |
109 |
| - <IsNativeImage>%(Reference.IsNativeImage)</IsNativeImage> |
110 |
| - <LinkBase>%(Reference.LinkBase)</LinkBase> |
111 |
| - <Name>%(Reference.Name)</Name> |
112 |
| - <OutputItemType>%(Reference.OutputItemType)</OutputItemType> |
113 |
| - <Package>%(Reference.Package)</Package> |
114 |
| - <Private>%(Reference.Private)</Private> |
115 |
| - <PrivateAssets>%(Reference.PrivateAssets)</PrivateAssets> |
116 |
| - <Project>%(Reference.Project)</Project> |
117 |
| - <Properties>%(Reference.Properties)</Properties> |
118 |
| - <Publish>%(Reference.Publish)</Publish> |
119 |
| - <ReferenceOutputAssembly>%(Reference.ReferenceOutputAssembly)</ReferenceOutputAssembly> |
120 |
| - <SetPlatform>%(Reference.SetPlatform)</SetPlatform> |
121 |
| - <SkipGetTargetFrameworkProperties>%(Reference.SkipGetTargetFrameworkProperties)</SkipGetTargetFrameworkProperties> |
122 |
| - <Targets>%(Reference.Targets)</Targets> |
123 |
| - <UndefineProperties>%(Reference.UndefineProperties)</UndefineProperties> |
124 |
| - <Watch>%(Reference.Watch)</Watch> |
125 |
| - </_AllProjectReference> |
126 |
| - |
127 |
| - <ProjectReference Include="@(_AllProjectReference->WithMetadataValue('Use', '1')->'%(ProjectPath)')" Use="" /> |
128 |
| - <Reference Remove="@(_AllProjectReference->WithMetadataValue('Use', '1'))" /> |
| 93 | + <!-- |
| 94 | + For the _CheckForReferenceBoundaries target, mark project reference providers that _should_ be referenced with |
| 95 | + Reference items but weren't. General principle is to use only Reference items when referencing a provider. |
| 96 | + This simplifies project moves and shortens files. |
| 97 | + --> |
| 98 | + <ProjectReferenceProvider Update="@(ProjectReference->'%(Filename)')" DirectUse="1" /> |
| 99 | + |
| 100 | + <!-- Find Reference items satisfied using project reference providers. --> |
| 101 | + <Reference Update="@(ProjectReferenceProvider)" ProjectPath="%(ProjectReferenceProvider.ProjectPath)" /> |
| 102 | + |
| 103 | + <ProjectReference Include="@(Reference->Distinct()->'%(ProjectPath)')" /> |
| 104 | + <Reference Remove="@(Reference->HasMetadata('ProjectPath'))" /> |
129 | 105 | </ItemGroup>
|
130 | 106 |
|
131 | 107 | <!--
|
|
136 | 112 | <Target Name="_CheckForReferenceBoundaries" BeforeTargets="CollectPackageReferences;ResolveReferences">
|
137 | 113 | <Error
|
138 | 114 | Condition="@(_InvalidReferenceToNonSharedFxAssembly->Count()) != 0 AND '$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)'"
|
139 |
| - Text="Cannot reference "%(_InvalidReferenceToNonSharedFxAssembly.Identity)". This dependency is not in the shared framework. See docs/SharedFramework.md for instructions on how to modify what is in the shared framework." /> |
| 115 | + Text="Cannot reference "%(Identity)". This dependency is not in the shared framework. See docs/SharedFramework.md for instructions on how to modify what is in the shared framework." /> |
140 | 116 |
|
141 | 117 | <Error
|
142 |
| - Condition=" '$(EnableCustomReferenceResolution)' == 'true' AND @(_AllProjectReference->WithMetadataValue('DirectUse', '1')->Count()) != 0 " |
143 |
| - Text="Cannot reference "%(_AllProjectReference.Identity)" with a ProjectReference item; use a Reference item." /> |
| 118 | + Condition=" '$(EnableCustomReferenceResolution)' == 'true' AND @(ProjectReferenceProvider->WithMetadataValue('DirectUse', '1')->Count()) != 0 " |
| 119 | + Text="Cannot reference "%(Identity)" with a ProjectReference item; use a Reference item." /> |
144 | 120 | </Target>
|
145 | 121 |
|
146 | 122 | <Target Name="_WarnAboutRedundantRef" AfterTargets="ResolveFrameworkReferences;ProcessFrameworkReferences">
|
|
0 commit comments