> For the complete documentation index, see [llms.txt](https://bhplugin.gitbook.io/bhdesk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bhplugin.gitbook.io/bhdesk/installations.md).

# Installations

## Prerequisite

* **Visual Studio 2022** (latest version supports .NET Core 8 SDK) or greater version OR **Visual Studio Code** (**VS Code**)
* **SQL Server 2012** or greater version
* Download and Install [**Node.js**](https://nodejs.org/en/download/) if you have not installed in your machine.
* Download and install [**ASP.NET Core 8.0 SDK if not (For Visual Studio).**](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
* Download and install .NET core hosting bundle for .NET Runtime and IIS support [**Windows Hosting Bundle Installer.**](https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-8.0.14-windows-hosting-bundle-installer)
* Download and Install Rewrite URL SDK for IIS [**URL Rewrite SDK**](https://www.iis.net/downloads/microsoft/url-rewrite)**.** (Required for IIS hosting rewrite URL in local machine)

## Setup

1. Download and Extract zip file in your local directory.
2. Open the solution in **Visual Studio** or **VS Code.**
   * This project is built using **.NET Core** with **Angular** integrated into a single solution. All **.NET Core** files are located in the root folder, while all **Angular** files are contained within the `ClientApp` folder.
3. Configure **Database** and **API**.
   * Please find the **.bak** file and **.sql script** file of the database. Restore the database using either the **.bak** file or the **.sql script**.
   * After restoring the database, update the connection string in the project by following the steps below:
     * Open the **`bhdesk/appsettings.json`** file.
     * Update the **`ConnectionStrings`** section.
       * Use **`local_conn_string`** for the local database connection.
       * Use **`server_conn_string`** for the server database connection.

## Run Project

1. You can run the project using any of the following methods in **Visual Studio**:
   * Press **F5** to start the project with debugging.
   * Press **Ctrl+F5** to start the project without debugging.
   * Right-click on the **bhdesk** project, then navigate to **Debug > Start New Instance**.\
     \
     All required packages will be automatically installed when you run the project.
2. You can run the project using any of the following methods in **VS Code**:
   * **Run from Terminal:**
     * Open the integrated terminal in VS Code (`Ctrl + `` or View > Terminal`).
     * Navigate to the root folder of the project.
     * Use the following commands:\
       To restore packages:

       ```bash
       dotnet restore
       ```

       To build and run the project:

       ```bash
       dotnet run
       ```
   * **Run Using Debug Configuration:**
     * Open the **Run and Debug** view (`Ctrl + Shift + D` or View > Run and Debug).
     * Select the appropriate `.NET Core` debug configuration.
     * Click the **Start Debugging** button (`F5`) to run the project.

## Publish Project

1. **Update the Connection Strings**:
   * Before publishing, ensure the production server connection string is updated in the **`bhdesk/appsettings.json`** file.
   * Replace the **`server_conn_string`** value with the appropriate connection string for the production server.
2. **Publish the Project From Visual Studio:**
   * Right-click on the **bhdesk** project in Visual Studio.
   * Select **Publish** from the context menu.
   * Follow the publishing wizard to create the published output folder.
3. **Publish the Project From Visual Studio Code:**
   * Open the integrated terminal in VS Code (`Ctrl + `` or View > Terminal`).
   * Run the following command to publish the project:

     ```bash
     dotnet publish -c Release
     ```
4. **Upload to Windows Server**:
   * Transfer the published folder to the desired location on the Windows server.
   * Ensure all necessary permissions and configurations are set up for the application to run smoothly.
