Skip to content


Windows Windows   macOS macOS   Ubuntu Ubuntu   Docker Docker   Visual Studio Visual Studio   Visual Studio Code VS Code

Setting up the Development Environment

A quick guide to setting you up for Debugging, testing and adding your own additions to CodeProject.AI.

This current release works in Visual Studio Code on Windows 10+. Ubuntu and macOS (both Intel and Apple Silicon), and Visual Studio 2019+ on Windows 10+.

Download the Latest version       Fork on GitHub

Install the Prerequisites

If you wish to debug or make enhancements to the code then you should install:

  1. Visual Studio Code or Visual Studio 2019+. VS Code is available on Windows, macOS, Linux and Raspberry Pi. Visual Studio is available on Windows and macOS. We've tested against both, but not against other IDEs at this point

  2. Python. (Optional) You may add Python support either via the Visual Studio Installer, through Visual Code Extensions, or by downloading python directly. However, this is not needed since Python will be installed automatically as part of the development environment setup script.

  3. Install the .NET 7 SDK . (Optional)

    The development setup script will setup .NET for Windows, and will prompt you on how to set it up in Linux and macOS. Here's how to install .NET 7 yourself before you run the scripts.

    Download the .NET SDK 6 here and install

    For Ubuntu 18.04 or above first install the .NET packages

    Bash
    wget https://packages.microsoft.com/config/ubuntu/<UBUNTU-VERSION-HERE>/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
    sudo dpkg -i packages-microsoft-prod.deb
    rm packages-microsoft-prod.deb
    

    where <UBUNTU-VERSION-HERE> is the version of Ubuntu (use lbs_release -d to find your current version).

    To install the .NET 7 SDK on Ubuntu run

    Bash
    sudo apt-get update && \
      sudo apt-get install -y dotnet-sdk-7.0
    

    See Install the .NET SDK or the .NET Runtime on Ubuntu for more information.

    Download the standalone .NET SDK installers and install

Download and Setup the code:

  1. Clone the CodeProject.AI repository from GitHub

  2. In the Solution folder go to /src folder and run the installation scripts:

    1. For Windows: setup.bat
    2. For Ubuntu and macOS: bash setup.sh

    This will download required assets and setup the runtime environments.

Development using Visual Studio Code

You'll need the following extensions

  1. Python extension for Visual Studio Code

  2. C# extension for Visual Studio Code.

To Build and Debug

  1. Open the main application folder in VS Code

  2. Click the "Run and Debug" button on the left hand tab bar (the arrow)

  3. From the dropdown at the top of the window, select Build All & Launch Server. Select x64 for x86_64 chips (eg Intel, AMD), or Arm64 for Apple Silicon or Raspberry Pi.

    Choosing a launch profile

  4. Click the green arrow next to the dropdown

The dashboard webpage should launch after the code has built and the server has started.

Using the Windows Subsystem for Linux?

The Windows Subsystem for Linux (WSL) may first need to be installed on your Windows machine. Installing is as simple as opening a Powershell terminal and entering

PowerShell
wsl --install

More information can be found in Microsoft's guide.

You will also need to install Visual Studio Code for Ubuntu. The downloads for each platform are at Visual Studio Code Download page. For WSL select Ubuntu, 64 bit (under "Debian, Ubuntu" select '64 bit')

Once you have WSL and VS Code installed, you will also need to install the following VS code extensions:

  1. The Remote WSL Extension.

  2. The C# Extension for WSL, even if you've already installed it for Windows.

    Open an Ubuntu Terminal (we strongly recommend Windows Terminal for this) and type code .. Then head to the C# Extension page, choose install, and the extension should be installed. If you get a warning that there is an instance of VS Code already running, close VS code and hit the install button again.

  3. You probably want to also install a browser. For Google Chrome use

Bash
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt -y install ./google-chrome-stable_current_amd64.deb

Finally, you will need to install .NET 7 for Ubuntu. Follow the "Install the .NET 7 SDK" instructions for Ubuntu in the "Install the Prerequisites" section above.

You're now ready to edit and Debug CodeProject.AI inside WSL using VS Code.

For this demo we will use the same solution files we use in Windows. Editing and debugging the same files in Windows and in Linux makes life easy. Just be careful of those CRLF vs LF line endings.

  1. Navigate to your repo and launch VS Code. If your solution is in C:\Dev\CodeProject\CodeProject.AI then you would use

    Bash
    cd /mnt/c/Dev/CodeProject/CodeProject.AI
    code .
    
  2. Re-open in WSL by hitting Ctrl+Shift P for the command pallete, select "Remote-WSL: Reopen Folder in WSL" and hit enter.

You are now coding against the existing Windows repository, but using a remote connection to the WSL system from within VS Code. From within this current environment it's all Linux. Run the setup scripts (the Linux version) and you're on your way. Easy, right?

Development using Visual Studio 2019 or later

  1. Open the solution in Visual Studio and build the entire solution
  2. Start a new instance of the /src/API/Server/Frontend project

The dashboard should appear and you're on your way.

You may wish to have the Python workflow enabled in Visual Studio. While not critical, it does help with debugging.

To run and debug the Server and the demo .NET application

There are two ways you can do this:

  1. Separately start both the projects in debug mode:

    1. In Solution Explorer, open demos / .NET and right-click on CodeProject.AI.Explorer and choose Debug -> Start new instance.
    2. In Solution Explorer, open src / API / Server and right-click on FrontEnd and choose Debug -> Start new instance.
  2. Configure Visual Studio to start multiple projects:

    1. In Solution Explorer, right-click on the solution and select Set Startup Projects.... The Solution property page will appear

      Set Startup Projects

    2. Check "Multiple Startup Projects" and select the Frontend API server and the CodeProject.AI.Explorer projects.

    Now when you start with or without debugging, both the Server and demo projects with start.