In order to be able to run the build and automated tests locally, you need to install following software:
- Microsoft .NET Framework 3.5 Service Pack 1
- .NET Framework 4.8 Developer
- sqlcmd (comes with SQL Server, so needed to be installed if only it is not installed)
- Java: Oracle or Openjdk (
choco install openjdk11). It is needed for running Ant builds only - Ant (
choco install ant) - git (
choco install git) - SSMS
- Set system environment variables. You can do it either in command prompt (elevated mode is needed)
Paths given as example, change it to the valid locations
Trailing slashes are not allowed
setx AntHome "%PROGRAMDATA%\chocolatey\lib\ant\tools\apache-ant-1.10.9" /M
setx NET4Home "%WINDIR%\Microsoft.NET\Framework\v4.0.30319" /M
setx SQLCMDPath "%PROGRAMFILES%\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn" /M
or
-
Open File Explorer window (WinKey + E)
-
Click on the Path Bar (behind the current path, not on) or Alt + D
-
Type in
Control Panel\System and Security\System -
Hit Return
-
Select Advanced system settings
-
Click on Environment Variables… button
-
Create 3 new system variables (note that paths should exist, you might need to change them for your setup)
Variable Value AntHome %PROGRAMDATA%\chocolatey\lib\ant\tools\apache-ant-1.10.9 NET4Home %WINDIR%\Microsoft.NET\Framework\v4.0.30319 SQLCMDPath %PROGRAMFILES%\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn
-
Enable TCP connection on SQL Server Instance. Follow these instructions
-
Create instance alias
Dev_tSQLttolocalhost(optional). You can use eitherSql Server Configuration Manageror TCP alias incliconfig.exe(C:\Windows\SysWOW64\cliconfig.exe,C:\Windows\System32\cliconfig.exe)- Open Sql Server Configuration Manager
- Navigate to SQL Native Client 11.0 Configuration --> Aliases and/or SQL Native Client 11.0 Configuration (32bit) --> Aliases (you can add them both if you are not sure)
- Fill
Dev_tSQLtas Alias Name and port if it is not default one
-
git clone tSQLt Sources
https://github.com/tSQLt-org/tSQLt.git -
If you do not have access to the original key (probably not), create self-signed key without password, using Strong Name Tool (sn.exe). You can run .\tSQLtCLR\OfficialSigningKey\InstallSigningKey.bat
- cd .\tSQLtCLR\OfficialSigningKey
- copy tSQLtOfficialSigningKey.pfx tSQLtOfficialSigningKey.pfx_backup
- "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools"\sn.exe -k tSQLtOfficialSigningKey.pfx
- Run .\tSQLtCLR\OfficialSigningKey\InstallSigningKey.bat file
- InstallSigningKey.bat
-
Re-start SSMS (if it was open)
-
Go to
Tools --> External Tools, tickUse Output Windowand fill:Property Value Title tSQLt local Dev_tSQLt Command $(SolutionDir)\Build\LocalBuild.bat Arguments %AntHome% %Net4Home% "%SQLCMDPath%" Dev_tSQLt tSQLt_dev Initial directory $(SolutionDir) 
-
Open the solution
File --> Open --> Project/Solutionor Ctrl + Shift + O and choose tSQLt.ssmssln file
If everything was done correctly you should see in the output window:
BUILD SUCCESSFUL
Total time: 1 minute 19 seconds
+-------------------------+
: BUILD SUCCEEDED :
+-------------------------+
Try to run Build\TestEnvironment.ps1 script to test your environment setup





