Question

I would like to create a TFS 2013 build definition, which builds a SQL project and outputs the complete CREATE DATABASE script to the bin folder.

When I compile my project on the local machine, the SQL script is output to the bin[configuration] folder correctly as per the database project settings.

However when I build the same project using TFS build automation, the build succeeds but no bin folder is created and no sql script is output.

Any ideas what I'm doing wrong?

Additionally, when the script is output locally, the paths are blank:

:setvar DefaultDataPath ""
:setvar DefaultLogPath ""

Any idea how I can populate these for SQL Server 2008 r2 defaults?

Edit:

Actually, if I set the build to target only the .sqlproj file, then the bin is output correctly. The problem comes when the sqlproj is built as part of a solution with other projects.

The build agent does not create individual bin folders in the src working directory; only the start-up project's output is produced and copied to the final bin folder.

I would like the build to generate the sql script and copy it to the output folder along with the other project outputs.

Is this possible?

Was it helpful?

Solution

I ended up going with a workaround based upon This Answer.

If I build the database project as part of the solution, the script does end up in the drop folder, just not the build agent's working folder.

Using:

<CommentOutSetVarDeclarations>True</CommentOutSetVarDeclarations>

in the publish profile allows me to set the default path etc. from the command prompt which was an acceptable alternative in my case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top