TFSBuild.proj ItemGroup's, AdditionalReferencePath's and such
I am modifying my TFSBuild.proj to use osql to update my stored procedures. I've done this with stand-alone msbuild with no problem, but am trying to figure out how to integrate into a team build and decided to use a AfterCompile target as so:
<ItemGroup>
<CodeFiles Include="**\*.sql" />
</ItemGroup>
<!-- Custom section for SQL Stored Proc updates -->
<PropertyGroup>
<DbServer>server</DbServer>
<DbName>database</DbName>
<SprocDir>$(SolutionRoot)\SolutionDir\DatabaseProjectDir\StoredProcedures</SprocDir>
</PropertyGroup>
<Target Name="AfterCompile">
<!-- exec each script with osql -->
<Exec Command="osql -E -S $(DbServer) -d $(DbName) -i $(SprocDir)\%(CodeFiles.Identity)"/>
</Target>
My problem is I don't know how to get the enumeration of .sql files (<CodeFiles>) from <ItemGroup> to the <exec> command. I see the TFSBuild.proj template specifies <AdditionalReferencePath>'s as a way to specify directories, but that construct won't work for enumerating files at runtime.
Any ideas how I could correlate a <CodeFiles> to my <Exec>? Is a custom task with a unique Item type the only way?
THanks for the help.

