<PropertyGroup>
<fileName>$(FilePath.Substring($(FilePath.LastIndexOf('\'))))</fileName>
</PropertyGroup>
I tried the above code. But am getting the file name including the last '\'. For eg. \Data.xml. I need only Data.xml. How can I get it?
Thank you...
You could add another Substring call or so to strip the first character, but more convenient and less error-prone is to use the proper System.IO.Path function, see Property Functions:
<PropertyGroup>
<fileName>$([System.IO.Path]::GetFileName('$(FilePath)'))</fileName>
</PropertyGroup>