locked
Trailing slash? RRS feed

  • Question

  •  

    Hi All,

     

    One thing that I come across with MSBuild is the trailing slash for directory.  Property like $(MSBuildProjectDirectory) doesn't have a trailing slash, which property like OutDir demands a trailing slash.  So what the is design behind this madness?  When I author my own custom MSBuild script, I keep asking should I standardise on all directory property paths with a trailing slash?  Or shoudn't I?

     

    Saturday, September 15, 2007 1:11 AM

Answers

  • It's not terribly consistent :-) We might clean this up in the future, perhaps by having typed properties, so you could have a "directory" type.

     

    Two things that might help are (1) if you have an extra slash, it works just fine. So you can err on the side of having a slash. (2) You can use the HasTrailingSlash function to make sure there's a trailing slash. See microsoft.common.targets for an example.

     

    Dan

     

     

    Saturday, September 15, 2007 9:48 PM