Skip to content

SqlCodeRefactorFilesTask

This topic the MSBuild SqlCodeRefactorFilesTask task that is available with SQL Enlight.

The task tuns code refactorings on T-SQL script files.

Name Description
Refactorings A list of code names of the refactorings which to be applied. Items can be separated with ‘,’,‘;’ or pipe char. Example: RE0001,RE0002,RE0006
InputPath Required. Source T-SQL files location.Multiple files can be provided by separating each file with semicolon. The ‘-’ prefix can be used to exclude specific files.Example: “c:\my files*.sql” .
OutputPath Required. Output location for the reformatted T-SQL script files. Example: “c:\my files\result" .
ServerName Deprecated. Target SQL Server name.
DatabaseName Deprecated. Target database name. Default is “master”.
Username Deprecated. Username for accessing the database. If omitted integrated security will be used.
Password User password for accessing the database. If omitted integrated security will be used.
LicenseKey Required. SQL Enlight for Build Machines license key.
LicenseData Required. Path to a license activation response XML file.

Example MSBuild project SqlCodeRefactorFiles:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Ubitsoft.SqlEnlight.Tasks.SqlCodeRefactorFilesTask"
AssemblyFile="C:\Program Files (x86)\Ubitsoft\SQL Enlight\Ubitsoft.SqlEnlight.Tasks.dll" />
<PropertyGroup>
<SqlEnlight_InputPath>E:\Projects\MyProject\SQL Script\*.sql</SqlEnlight_InputPath>
<SqlEnlight_OutputPath>E:\Projects\MyProject\SQL Script\Refactored\</SqlEnlight_OutputPath>
<SqlEnlight_Refactorings>RE0001, RE0002, RE0003</SqlEnlight_Refactorings>
<SqlEnlight_LicenseKey>ABCD-1234-XYZ-QWER-AAAA</SqlEnlight_LicenseKey>
<SqlEnlight_LicenseData>E:\SQL Enlight\license-activation-response.XML</SqlEnlight_LicenseData>
</PropertyGroup>
<Target Name="RefactorScriptsTarget">
<Message Text="Starting SQL code refactoring..." />
<Message Text="Running SQL code refactoring '$(SqlEnlight_InputPath)'..." />
<SqlCodeRefactorFilesTask
ContinueOnError="false"
Refactorings="$(SqlEnlight_Refactorings)"
InputPath="$(SqlEnlight_InputPath)"
OutputPath="$(SqlEnlight_OutputPath)"
LicenseKey="$(SqlEnlight_LicenseKey)"
LicenseData="$(SqlEnlight_LicenseData)" />
<Message Text="Completed SQL code refactoring!" />
</Target>
</Project>

SqlCodeAnalyzeFilesTask

SqlCodeAnalyzeServerTask

SqlCodeLayoutFilesTask