Skip to content

Commit d90c552

Browse files
jasonhornerrwestMSFT
authored andcommitted
Update pre-post-deployment scripts documentation
Added notes on managing SQL scripts in SDK-style projects.
1 parent f572350 commit d90c552

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/tools/sql-database-projects/concepts/pre-post-deployment-scripts.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,21 @@ Those files should be excluded from the database model build by setting the `Bui
6262
</Project>
6363
```
6464

65+
In SDK-style SQL projects, adding a `Build Remove="path\file.sql"` entry removes the file from the project entirely, which causes it to no longer appear in the Visual Studio Code project view. To keep the file visible while still excluding it from model compilation, add it again as a `None` item:
66+
67+
```xml
68+
...
69+
<ItemGroup>
70+
<Build Remove="scripts\script1.sql" />
71+
<None Include="scripts\script1.sql" />
72+
<Build Remove="scripts\script2.sql" />
73+
<None Include="scripts\script2.sql" />
74+
</ItemGroup>
75+
</Project>
76+
```
77+
78+
This prevents the file from being compiled as part of the database model while keeping it visible in the project.
79+
6580
> [!TIP]
6681
> You can validate the pre-deployment and post-deployment scripts after project build, by changing the `.dacpac` file extension to `.zip` and unarchiving the `.zip` to a folder. A single `.sql` file is present for pre-deployment and post-deployment scripts, and should contain the entire Transact-SQL contents of all referenced files in the originating SQL project.
6782

0 commit comments

Comments
 (0)