How to package database scripts into C# projects and .NET executables

For users that need to build deployment packages across environments from SQL scripts, either by using the C# project or .NET executable, ApexSQL Build offers an efficient way to accomplish this task in a few simple steps. This applies, for example, to situations where development changes to the structure and content of a production database need to be pushed as an upgrade

The Consolidate scripts feature is easily accessible and it is located in the main window of ApexSQL Build. Besides other options, the user has the Create C# projects with complete source code and Create .NET executable file options available. A package creation process is basically the same for both output types with just a few different details

The process starts with the addition of SQL script files and forming a deployment list, i.e. the package content. In some cases the order of SQL script files is essential for the deployment, so they can be easily rearranged if necessary with the Up/Down commands

Once a package content is formed, additional Package options can be set up:

The Version tab offers the possibility to create the package version and, in case of regular multiple update deployments, to keep track of changes and upgrades made in a chronological order

So, what about the mentioned differences in the packaging process?

The process differs in a few details depending on the previously chosen option. In case of Packaging scripts into C# projects option, ApexSQL Build offers the selection of a Visual Studio version. If the Packaging scripts into .NET executable option is selected, besides already described common settings, the user has an option to select a database name for a package to be executed upon.

Using the ApexSQL Build engine for creating and deploying C# projects and .NET executables is a simple process which can significantly speed up and make more reliable any kind of database schema upgrade processes

March 12, 2015