Friday, June 22, 2012 10:03 PMBased on other posts, it looks like post-deploy scripts normally do get included in incremental scripts generated via SqlPackage. However, they don't with mine. I wonder if it's because I have 2 projects, Internal and External, External depends upon Internal, and I use the IncludeCompositeObjects, but the post deployment scripts are defined in Internal. Is there a way to have SqlPackage include the pre/post deploy scripts?
Tuesday, June 26, 2012 10:00 AM
With referenced projects, only the post-deployment script from the outer project, the one that you initiate the deployment from, will be included. The IncludeCompositeObjects will pull all referenced objects into the database model that we build during deployment (or script generation), but will not pull in pre/post deployment scripts from the referenced project. If you instead include the post-deploy script in External does this work for you? Or, depending on file locations, it may be possible to reference the scripts in Internal in a post-deploy script in External by using SQLCMD syntax (:r <filepath>).
More details on :r syntax from msdn (http://msdn.microsoft.com/en-us/library/aa833281(v=VS.80).aspx):
- :r FileName
Parses additional T-SQL statements and SQLCMD commands from the file specified by FileName into the statement cache. FileName is read relative to the startup directory for Visual Studio. The file is read and executed after a batch terminator is encountered. You can issue multiple :r commands. The file can include any SQLCMD command, including the batch terminator that is defined in Tools, Options. You can use :r in a pre-deployment or post-deployment script to include other scripts.
Sarah McDevitt Program Manager SQL Server Data Tools
Tuesday, June 26, 2012 5:16 PMInstead of trying your options, I am trying to concatenate the output generated by SqlPackage with the postdeploy.sql residing in obj/Release. However, I am running into an issue. It appears the SqlPackage output is encoded as UCS-2/Little Endian and the postdeploy.sql as UTF-8. Why the difference?
Tuesday, June 26, 2012 8:26 PM
Richard, which version of SqlPackage are you using? There was a bug in the RTM version, however, the CU1 update should have all the output using UTF-8.
Tuesday, June 26, 2012 8:30 PMI'm guessing I have RTM. The EXE file date is 2/10/2012, product revision is 10.3.20116.0. Is there something which lists other differences between RTM and CU1?
Monday, July 02, 2012 11:58 PM
The documentation can be found here: http://support.microsoft.com/kb/2679368