TFSBuild.proj ItemGroup's, AdditionalReferencePath's and such

Hi,

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.

[1359 byte] By [Surly] at [2008-2-4]
# 1
Never mind. I got this to work by moving $(SprocDir) expansion to ItemGroup....my error.

<ItemGroup>
<CodeFiles Include="
$(SprocDir)\**\*.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 %(CodeFiles.Identity)"/>
</Target>

Thanks anyhow.

Surly at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Build Automation...
# 2
Please check out this link for more detail on how to use MSBuild syntax or try the MSBuild forum for quicker answers
Anutthara at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Build Automation...

Visual Studio Team System

Site Classified