Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSDT: Why can we need "Script (Build)"?

There are two options for creating scripts not bound to object creation/updating or pre/post deployment - Script (Build) and Script (Not in build).

Script (Not in build) can be used, for example, for including into a Pre-Deployment or Post-Deployment script by :r directive. They will just be included into generated deployment script.

I tried to use Script (Build) just to see how it is used. First, it did not recognize PRINT instruction: build just fails on it. Second, if I just leave a comment in Script (Build), it just never included into generated deployment script.

I also notices that if to open a Script (Not in build) in VS editor, it shows a toolbar of Execute-Parse-Plan-Connect, while I cannot see or turn on this toolbar for a Script (Build).

The question is - what is the purpose of introducing Script (Build)? How can I harness and use it, why can I need it? At which step of build does it make sense?

like image 253
moudrick Avatar asked Oct 20 '25 03:10

moudrick


1 Answers

If you display properties of the scripts you will see:

  • Script (Build) - Build Action = Build
  • Script (Not in build) - Build Action = None

So script not in build is just a helper file that you might want to include in a project but it wont be parsed nor compiled into dacpac.

Script Build is a regular file that is parsed and compiled into dacpac, it has the same meaning as table file or stored procedure file. One can use it if he doesn't like to go through Add Item menu or he just want to include multiple objects of different type in one file.

like image 105
scar80 Avatar answered Oct 23 '25 12:10

scar80