How to do it...
- Open Visual Studio Code.
- Press Ctrl + Shift + P to open the Command Palette and type or select AL:Go! to create a sample Hello World application.
- When prompted, enter the path to where the new project will be stored. You can leave it as the default path or type in a new one. Press Enter to confirm the path.
- When prompted, you need to select the sandbox type based on what you are working with. You have two options:
- Microsoft Cloud Sandbox: Select this option if you are hosting your development sandbox in Business Central (Option 1 in the Setting up your development sandbox section). When you select this option, you will be prompted to log in with your Microsoft account. Use the account under which you created the Business Central sandbox.
- Your own server: Select this option if you chose to put your sandbox in an Azure virtual machine, or on your local machine using a container or the installation media (Options 2 - 4 in the Setting up your development sandbox section). When you select this option, you will be prompted to log in. Press Escape to cancel the login.
- This step is only required if you selected Your own server in the preceding step. Skip to the next step if you selected Microsoft Cloud Server.
Before we log in to our development sandbox, we need to make sure that we have the correct connection configuration.
This information is stored in the launch.json file in the .vscode folder. You can view the file's contents by selecting it in the Visual Studio Code Explorer.
There are three properties that we need to look at here and set based on how we set up our development sandbox:
- Now that we have our configuration set up, we need to download symbols. At this point, Visual Studio Code may have already been prompting you to do that.
Press Ctrl + Shift + P to open the Command Palette and type or select AL: Download Symbols to download the symbols.
This will prompt a connection to be made to your development sandbox, and the symbols will be downloaded to your local machine. They will be placed in a folder named .alpackages, which you will see in the Explorer.
Once the symbols have been downloaded, you will see two files in the .alpackages folder, similar to what you can see in the following screenshot:
- Now, it's time to build and publish our application.
To do that, you can simply press F5, which will build the application and then publish it to your development sandbox in debug mode. If you do not want to publish it in debug mode, you can press Ctrl + F5.