SqlCodeRefactorFilesTask |
![]() |
This topic the MSBuild SqlCodeRefactorFilesTask task that is available with SQL Enlight.

The task tuns code refactorings on T-SQL script files.
Parameters
Name |
Description |
---|---|
Refactorings |
A list of code names of the refactorings which to be applied. Items can be separated with ‘,’,’;’ or ‘|’. 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 filesresult” . |
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
Example MSBuild project SqlCodeRefactorFiles:
1 <?xml version="1.0" encoding="utf-8"?> 2 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 3 4 <UsingTask TaskName="Ubitsoft.SqlEnlight.Tasks.SqlCodeRefactorFilesTask" 5 AssemblyFile="C:Program Files (x86)UbitsoftSQL EnlightUbitsoft.SqlEnlight.Tasks.dll" /> 6 7 <PropertyGroup> 8 <SqlEnlight_InputPath>E:ProjectsMyProjectSQL Script*.sql</SqlEnlight_InputPath> 9 <SqlEnlight_OutputPath>E:ProjectsMyProjectSQL ScriptRefactored</SqlEnlight_OutputPath> 10 <SqlEnlight_Refactorings>RE0001, RE0002, RE0003</SqlEnlight_Refactorings> 11 <SqlEnlight_LicenseKey>ABCD-1234-XYZ-QWER-AAAA</SqlEnlight_Refactorings> 12 <SqlEnlight_LicenseData>E:SQL Enlightlicense-activation-response.XML</SqlEnlight_Refactorings> 13 14 </PropertyGroup> 15 16 <Target Name="RefactorScriptsTarget"> 17 18 <Message Text="Starting SQL code refactoring..." /> 19 <Message Text="Running SQL code refactoring '$(SqlEnlight_InputPath)'..." /> 20 21 <SqlCodeRefactorFilesTask ContinueOnError="false" 22 Refactorings="$(SqlEnlight_Refactorings)" 23 InputPath="$(SqlEnlight_InputPath)" 24 OutputPath="$(SqlEnlight_OutputPath)" /> 25 LicenseKey="$(SqlEnlight_LicenseKey)" 26 LicenseData="$(SqlEnlight_LicenseData)" 27<Message Text="Completed SQL code refactoring!" /> 28 </Target> 29 </Project>
