1
votes

I'm having trouble directing the output of a TFS CI build to directory locations other than the default. I have 2 Database projects integrated with our large .net project. Everything builds and does just what we expect on the local PC. Files end up where you expect them under the database projects sql/Debug or Release folder. On our TFS build server the project builds and generates everthing properly but it dumps all of the database project output files (.SQL, .schema, etc)into the root of the TFS output directory. It's getting pretty messy there since there are several projects that seem to cause that to happen.

At the moment I am only concerned with the database projects. Is there a way to specify either in the deploy of the project or the build definition (or any where else I haven't thought to look) where these files will be output?

thanks

1

1 Answers

0
votes

A simple way to do this is to create an MSbuild project that runs at the end of the compilation process.

Create file called DropTidy.Proj and then add something like the following.

<Project DefaultTargets="CopySQLReleaseFiles" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">

  <Target Name="CopySQLReleaseFiles">

    <ItemGroup>
      <SqlBuildOutput Include="$(OutDir)\*.sql" />
    </ItemGroup>

    <Copy SourceFiles="@(SqlBuildOutput)" DestinationFolder="$(OutDir)\SQL" />

  </Target>

</Project>

The example above will copy all files with an extensions of "sql" in to a folder called "SQL". $(OutDir) is the working folder used by team build that relelates to the "Binaries" folder in the build workspace on your build agent

Check the file in to TFS and then add it to your "Items to Build" list in the Team Build Process. Make sure that it's the last "Solution" in the list so that it runs after the other solutions in your build. Also make sure that the folder you checked the proj file in to is part of your builds workspace.

Run your build and you should see a new folder called SQL in your drop location.