Question: When creating MSBuild Items from files using wildcards, such as,

```
<ItemGroup>
  <Scripts>$(ScriptsDirectory)\**\*.sql</Scripts>
</ItemGroup>

```

the files *seem* to always be sorted alphabetically by path. 

However, is this sort order guaranteed - can I rely on it?

Answer: 
Yes, MSBuild will always sort alphabetically by path, in order to guarantee repeatability. (This is covered in my new book, "MSBuild Trickery")
I needed to sort an ItemGroup of files based on the actual filename, not the full path. So I wrote an MSBuild task to do this, hope it helps...

[MSBuild sort itemgroup of files by filename](http://jpadda.wordpress.com/2012/01/05/sort-2-dimensional-jagged-array-csharp/)