I need to convert the function "path::combine(path1, path2)". Please help me if you have some idea. Thank you!
views:
146answers:
1
+1
A:
Use the CombinePath Task:
<Project DefaultTargets="DefaultTarget" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MyBasePath>.\a\b</MyBasePath>
<MySecondPath>c\d</MySecondPath>
</PropertyGroup>
<Target Name="Combine">
<PropertyGroup>
<MySecondPath Condition="$(MySecondPath)==''">.\</MySecondPath>
</PropertyGroup>
<CombinePath BasePath="$(MyBasePath)" Paths="$(MySecondPath)">
<Output TaskParameter="CombinedPaths" PropertyName="CombineOutput" />
</CombinePath>
</Target>
<Target Name="DefaultTarget" DependsOnTargets="Combine">
<Message Text="Result from Combine is $(CombineOutput)" />
</Target>
</Project>
Filburt
2010-03-24 22:17:04
Thank you! It's so strange because I look for the task in MSBuild Task Reference from http://msdn.microsoft.com/en-us/library/7z253716(v=VS.90).aspx. Microsoft doesn't list <CombinePath... > there. :(
Nam Gi VU
2010-03-25 10:00:45
I've tested I found that: When the second path is empty, CombinePath doesn't return the first path. So, we should note this small difference when compared with NAnt path::combine.
Nam Gi VU
2010-03-25 11:20:35