Forum Discussion
Publishing into Target Warehouse using VS Code causing issues
- 3 months ago
Hi AnmolGan81 ,
Thanks for your Patience.
Yes, post-deployment scripts can be used as part of the SQL Database Project deployment flow in a DevOps pipeline. In this scenario, they are particularly useful because the issue is occurring during design-time validation rather than during runtime execution inside the Fabric Warehouse.
A practical workaround is to separate the main schema deployment from the stored procedures containing dynamic SQL or unsupported dependency references.
Edit the .sqlproj file directly and add a <PostDeploy> item inside the <ItemGroup> section:
<ItemGroup> <PostDeploy Include="scripts\after-script.sql" /> </ItemGroup> Similarly, pre-deployment scripts can be added using: <ItemGroup> <PreDeploy Include="scripts\before-script.sql" /> </ItemGroup>When the SQL project is built, these scripts are packaged into the generated DACPAC. During deployment through the DevOps pipeline using tools such as SqlPackage or DACPAC deployment tasks, the execution order is handled automatically:
1.Pre-deployment script
2. Schema deployment/publish
3. Post-deployment scriptSince post-deployment scripts execute after schema publish completes, they may help bypass the dependency validation failures occurring during the build/publish phase.
Hopefully, separating the procedures containing dynamic references from the primary schema deployment helps resolve the deployment validation issue in your scenario
For more information refer to the documentation:
add-pre-deployment-and-post-deployment-scripts
Best Regards,
Abdul Rafi
Hi AnmolGan81 ,
Could you please confirm if the issue has been resolved? If not, feel free to reach out if you have any further questions.
Your update would be helpful for other members who may face a similar issue.
Best Regards,
Abdul Rafi