I'm trying to define a new, custom element in Directory.Build.targets: <DynamicReference>. This definition should be a combination of <Reference> and <PackageReference>. The decision of which to use will be predicated on the Boolean properties "DynamicReferencesUseLocal" and "DynamicReferencesUsePackages".
The behavior I'm trying to achieve is simple, but I don't have much understanding of how to "alias" these items and/or combine them.
Given a project that imports this item, the intended result would be a project that's able to reference assemblies like so:
<ItemGroup>
<DynamicReference Prefer="Package">
<PackageName>MyFramework.UI</PackageName>
<PackageVersion>2.0.*</PackageName>
<LocalPath>C:/SomePath/MyFramework.UI.dll</LocalPath>
</DynamicReference>
</ItemGroup>
Essentially this is the same as defining two ItemGroups using a Condition attribute. This seems a little bloated when there's many references.
ProjectReferenceandPackageReference? (A use case for switching betweenReferenceandPackageReferenceseems very unusual.)