# Deploy from source code

## Introduction

SQLWATCH is developed in Visual Studio Community. You can obtain a free copy of the Community edition on [Microsoft website](https://visualstudio.microsoft.com/vs/express/). You can also use Visual Studio Standard or Professional.

{% embed url="https://visualstudio.microsoft.com/vs/express/" %}

## Prerequisites

1. Visual Studio with SQL Server Data Tools (SSDT) installed.&#x20;

{% embed url="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" %}

## Installation

Download source code from GitHub. If you are planning on contributing to the project or making changes you will have to clone (or fork) the latest master or development branch. You can also download a source code attached to a release which will contain snapshot of the master branch at the time of build.

To deploy from Visual Studio follow the below steps:

Open solution in Visual Studio and go to Build in the main menu and select Publish SQLWATCH:

![Visual Studio build project](https://560149426-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LamHUpIpVXoBUUDZZpO%2F-Laosgay3G49AakSTkrj%2F-LaoumCOdwP43mooVwhy%2Fdeploy_from_visual_studio_solution.png?alt=media\&token=3edf3a23-b5b6-4a5a-9354-ebed3bec677a)

Next, set connection to your SQL Server where you would like to deploy it:

![Visual Studio deployment parameters](https://560149426-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LamHUpIpVXoBUUDZZpO%2F-Laosgay3G49AakSTkrj%2F-LaouwEaX6t1THgq9RVU%2Fdeploy_datatier_application_and_register.png?alt=media\&token=b041c8a2-e791-47ae-9b67-83404e3c6b15)

> Make sure you tick “Register as a Data-tier Application” in the Publish Database Options. This will make an entry in the `msdb.dbo.sysdac_instances` which will allow you to see which version is installed.

```
select * from msdb.dbo.sysdac_instances where database_name = 'SQLWATCH'
```

![](https://560149426-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LamHUpIpVXoBUUDZZpO%2F-Laosgay3G49AakSTkrj%2F-LaovVKttPByWa63g1bt%2Fsysdacinstances.png?alt=media\&token=45e8eefb-81ac-40a3-a5ea-eb9e40eab84a)

You can track progress in the Output pane:

![Visual Studio deployment progress](https://560149426-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LamHUpIpVXoBUUDZZpO%2F-Laosgay3G49AakSTkrj%2F-Laov7Eop4gUu-mZBVuU%2Fdeploy_from_visual_studio_progress.png?alt=media\&token=fd86878b-bbfc-45cc-b3d5-1fdb4e7b6de9)
