5

I am trying to use TeamCity to automate the publish of my database project after it builds.

I am using the MSBuild runner with "Publish" targets

My SQL project contains a publish profile file "Test.publish.xml"

I used this MSBuild parameter to tell MSBuild which publish profile file to use:

/p:SqlPublishProfilePath=Test.publish.xml

The output path of the project has been modified, so instead of the default "bin\Output" it is "sql\Staging"

When the build step executes I get the error:

[12:19:11]Step 3/3: Publish (MSBuild) (5s)
[12:19:15][Step 3/3] Alpha\Alpha.sqlproj.teamcity: Build target: Publish
[12:19:15][Alpha\Alpha.sqlproj.teamcity] SqlPublish
[12:19:15][SqlPublish] SqlPublishTask
[12:19:15][SqlPublishTask] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(1717, 5): File "D:\BuildAgent\work\8c364da49a1f90ba\Alpha\bin\Output\Alpha.sqlproj.dacpac" does not exist.
[12:19:16][Step 3/3] Step Publish (MSBuild) failed

So, as you can see, it is looking for the .dacpac file in the standard bin\Output directory instead of the modified output directory path. Also, it is expecting the dacpac file to be called Alpha.sqlproj.dacpac, but my dacpac file is called Alpha.dacpac

What I need to do somehow is tell MSBuild where to find the dacpac file, because it is not taking any notice of the custom build output directory. Is there another MSBuild parameter or something that I can add to my publish profile file?

I know I could use sqlpackage.exe as an easy alternative, but it does not seem to be on the machine (at C:\Program Files\Microsoft SQL Server\110\DAC\bin), despite SQL Server Data Tools being installed and that is another battle I am working on...

Glen Thomas
  • 10,190
  • 5
  • 33
  • 65
  • It is much simpler to use sqlpackage (or use the dacfx) if it isn't on the machine then you can put the DAC folder (+ The transactsql.dll from the sdk folder) somewhere and reference that (it doesn't need installing). Doing it this way will make it all simpler and you can finish it quick and get home early! – Ed Elliott Jun 24 '16 at 14:20
  • Thanks Ed, I managed to find it in the end. It was hiding in a different location to what everyone online was saying! – Glen Thomas Jun 24 '16 at 15:01
  • Cool can you post what it was to help others finding this? – Ed Elliott Jun 25 '16 at 13:09
  • It doesn't answer this question, I mean I found the sqlpakage exe. I still don't know how to tell msbuild to use the correct output directory.. – Glen Thomas Jun 26 '16 at 13:53

0 Answers0