Combines the specified paths into a single path.
The following table describes the parameters of the CombinePath task.
The base path to combine with the other paths. Can be a relative path, absolute path, or blank.
A list of individual paths to combine with the BasePath to form the combined path. Paths can be relative or absolute.
The combined path that is created by this task.
In addition to the parameters listed above, this task inherits parameters from the TaskExtension class, which itself inherits from the Task class. For a list of these additional parameters and their descriptions, see TaskExtension base class.
The following example shows how to create an output folder structure using
CombinePath to construct the property
$(OutputDirectory) by combining a root path
$(PublishRoot) concatenated with
$(ReleaseDirectory) and a subfolder list
<PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp3.1</TargetFramework> <PublishRoot>C:\Site1\</PublishRoot> <ReleaseDirectory>Release\</ReleaseDirectory> </PropertyGroup> <ItemGroup> <LangDirectories Include="en-us\;fr-fr\"/> </ItemGroup> <Target Name="CreateOutputDirectories" AfterTargets="Build"> <CombinePath BasePath="$(PublishRoot)$(ReleaseDirectory)" Paths="@(LangDirectories)" > <Output TaskParameter="CombinedPaths" ItemName="OutputDirectories"/> </CombinePath> <MakeDir Directories="@(OutputDirectories)" /> </Target>
The only property that
CombinePath allows to be a list is
Paths, in which case the output is also a list. So, if
$(PublishRoot) is C:\Site1\, and
$(ReleaseDirectory) is Release\, and
@(LangDirectories) is en-us;fr-fr\, then this examples creates the folders: