For anybody who wants to do this...
I first create an msbuild target that simply builds the solution, and then I
call a custom console app I wrote that simply searches the manifest.xsf
(using XPath) to find all the files that belong in the XSN document, and
then put them together using the CABSDK. A gotcha I found is that after the
MSBuild of the project, I had to XCopy the contents of the template source
file into another directory (my Post Build event in visual studio) because I
wasnt able to access them directly from my console app (said the files were
already in use).
<PropertyGroup>
<SolutionFile>SharepointForms\SharepointForms.sln</SolutionFile>
</PropertyGroup>
<Target Name="Build"
DependsOnTargets="CompileInfoPathSolution;BuildInfoPathXSN" />
<Target Name="CompileInfoPathSolution">
<Message Text="Building solution" />
<MSBuild Projects="$(SolutionFile)" />
</Target>
<Target Name="BuildInfoPathXSN">
<Message Text="Packaging the InfoPath source files up into the XSN
file." />
<Exec
command="..\Utilities\InfoPathTemplateConverter\build\InfoPathSourcePackager
$(PermitApplicationSourceFiles) $(PermitApplicationXSNFileOutput)" />
</Target>
See the "CreateFileFromXSN" portion of this document...
http://msdn2.microsoft.com/en-us/library/bb608315(office.11).aspx I rewrote
that javascript in C# inside of a console application and it works great.
Good luck.