mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-22 19:10:41 -10:00
* Validate that reference assembly projects only reference other reference assembly projects * Permit ref->src reference if src project produces reference assembly * Move target to references.targets
63 lines
3.3 KiB
XML
63 lines
3.3 KiB
XML
<Project>
|
|
<PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
|
|
<!--
|
|
Disable RAR from transitively discovering dependencies for references. This is required as we don't copy
|
|
dependencies over into the output directory which means RAR can't resolve them.
|
|
-->
|
|
<_FindDependencies>false</_FindDependencies>
|
|
</PropertyGroup>
|
|
|
|
<!-- If a CoreLib ProjectReference is present, make all P2P assets non transitive. -->
|
|
<ItemGroup Condition="'@(ProjectReference)' != '' and
|
|
@(ProjectReference->AnyHaveMetadataValue('Identity', '$(CoreLibProject)'))">
|
|
<ProjectReference Update="@(ProjectReference)"
|
|
PrivateAssets="all" />
|
|
</ItemGroup>
|
|
|
|
<!-- Project references shouldn't be copied to the output for non test apps. -->
|
|
<ItemDefinitionGroup Condition="'$(IsTestProject)' != 'true' and '$(IsTestSupportProject)' != 'true'">
|
|
<ProjectReference>
|
|
<Private>false</Private>
|
|
</ProjectReference>
|
|
</ItemDefinitionGroup>
|
|
|
|
<!-- Filter out transitive P2Ps which should be excluded. -->
|
|
<Target Name="FilterTransitiveProjectReferences"
|
|
AfterTargets="IncludeTransitiveProjectReferences"
|
|
Condition="'$(DisableTransitiveProjectReferences)' != 'true' and
|
|
'@(DefaultReferenceExclusion)' != ''">
|
|
<ItemGroup>
|
|
<_transitiveProjectReferenceWithExclusion Include="@(ProjectReference)">
|
|
<Exclusion>%(DefaultReferenceExclusion.Identity)</Exclusion>
|
|
</_transitiveProjectReferenceWithExclusion>
|
|
<ProjectReference Remove="@(_transitiveProjectReferenceWithExclusion)"
|
|
Condition="'%(_transitiveProjectReferenceWithExclusion.NuGetPackageId)' == '%(_transitiveProjectReferenceWithExclusion.Exclusion)'" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<!-- Make shared framework assemblies not app-local (non private). -->
|
|
<Target Name="UpdateProjectReferencesWithPrivateAttribute"
|
|
AfterTargets="AssignProjectConfiguration"
|
|
BeforeTargets="PrepareProjectReferences"
|
|
Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
|
|
('$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true') and
|
|
'@(ProjectReferenceWithConfiguration)' != ''">
|
|
<ItemGroup>
|
|
<ProjectReferenceWithConfiguration PrivateAssets="all"
|
|
Private="false"
|
|
Condition="$(NetCoreAppLibrary.Contains('%(Filename);'))" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<ItemDefinitionGroup>
|
|
<TargetPathWithTargetPlatformMoniker>
|
|
<IsReferenceAssembly>$(IsReferenceAssembly)</IsReferenceAssembly>
|
|
</TargetPathWithTargetPlatformMoniker>
|
|
</ItemDefinitionGroup>
|
|
|
|
<Target Name="ValidateReferenceAssemblyProjectReferences" Condition="'$(IsReferenceAssembly)' == 'true'" AfterTargets="ResolveReferences">
|
|
<Error Condition="'%(ReferencePath.ReferenceSourceTarget)' == 'ProjectReference' AND '%(ReferencePath.IsReferenceAssembly)' != 'true' AND '%(ReferencePath.ReferenceAssembly)' == ''"
|
|
Text="Reference assemblies must only reference other reference assemblies and '%(ReferencePath.ProjectReferenceOriginalItemSpec)' is not a reference assembly project and does not set 'ProduceReferenceAssembly'." />
|
|
</Target>
|
|
</Project>
|