3 つのデータベース プロジェクトを使用したソリューションがあります。生成された 3 つの dacpac はすべて順次展開されますが、何らかの理由で、これらの dacpac の 1 つが展開後のスクリプトを実行しません。
sqlpackage を使用して diffscript を作成していますが、diffscript にはデプロイ後のステートメントが正しく含まれています。
IF EXISTS (SELECT * FROM #tmpErrors) ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT>0 BEGIN
PRINT N'The transacted portion of the database update succeeded.'
COMMIT TRANSACTION
END
ELSE PRINT N'The transacted portion of the database update failed.'
GO
DROP TABLE #tmpErrors
GO
/*
Post-Deployment Script Template
--------------------------------------------------------------------------------------
This file contains SQL statements that will be appended to the build script.
Use SQLCMD syntax to include a file in the post-deployment script.
Example: :r .\myfile.sql
Use SQLCMD syntax to reference a variable in the post-deployment script.
--------------------------------------------------------------------------------------
*/
print 'SCRIPT: dbo.MEMTYPES.data.sql'
ここで: a) コメントはヘッダー postdeployment.sql スクリプトにあり、標準構文を使用して他のスクリプトを呼び出します: :r .\dbo.MEMTYPES.data.sql 、および b) 行 " print 'SCRIPT: dbo.MEMTYPES. data.sql'" は、配置後スクリプトで定義された最初の子スクリプトの最初の行です。
ただし、実行すると、展開のログは次の行で終了します。
The transacted portion of the database update succeeded.
これは、dacpac スキーマの変更が適用された (実際に適用された) ことを意味しますが、おそらく、デプロイ後のタスクを実行するためにスクリプトを続行する試みは行われませんでした。
何か案は?