I’m trying to define a new, custom element in Directory.Build.targets: . This definition should be a combination of and . 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.
Jarryd Le Breton is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.