How to start working with the Business Central Modern Development Environment

Download and install Visual Studio Code (VS CODE). The installation process is simple and quick.

Out of the box Visual Studio Code cannot work with the new development environment of Business Central. So the next thing to do is to extend VS Code by activating the AL Language extension. Please first check if you have installed the VS extension (by running the Business Central setup) before continuing on. If you don’t have this file you didn’t select the Extension during the BC Setup.

2019-01-21 16_00_01-bcs01 op irasoelbaks - verbinding met virtuele machine

If installed: Start VS Code, go to Extensions > Menu and select Install From VSIX. Browse to the location where the extension is installed. For example, ‘C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\130\AL Development Environment’ and press the Install button. The extension will now be installed. After the installation is completed click the ‘Reload Now’ button on the right bottom of your page. Now Close VS Code.

Install Extension.gif

Next we need to check the technical Business Central configuration first before we can move on:

Verify if ‘Enable Developer Service Endpoint’ is enabled on the server instance

2019-01-21 16_25_16-bcs01 op irasoelbaks - verbinding met virtuele machine

Next, check if the Web Client Base URL has been configured:

2019-01-21 16_48_37-bcs01 op irasoelbaks - verbinding met virtuele machine

Also check if you can start the Windows or Web Client in order to ensure a correct configuration of certain BC settings.

In VS Code now press CTRL+SHIFT+P to open the command palette and choose AL:Go! Now perform the following steps:

  • Choose a path to a new empty folder.
  • Choose the server: Your own server. Don’t choose Microsoft Cloud Sandbox because this howto article is based on an on-prem scenario.
  • Specify username: skip this step by pressing the ESC key
  • Specify password: skip this step by pressing the ESC key
configure extension

Configuration via the command palette:

After the above steps a new file has been created called launch.json. Please change line 7, 8, 9, 10:

Name: your servername
Server: http://your server address
Serverinstance: name of the serverinstance that runs the client services
Authentication: authentication type

In my case the new launch.json looks like this:

{

"version": "0.2.0",

"configurations": [

{

"type": "al",

"request": "launch",

"name": "BC01",

"server": "http://localhost",

"serverInstance": "BC130",

"authentication": "Windows",

"startupObjectId": 22,

"startupObjectType": "Page",

"breakOnError": true

}

]

}

After changing the file please save the changes. If you press F5 now you most likely will encounter an error, like this one:

The request for path /BC130/dev/metadata failed with code InternalServerError. Reason: NetFx40_LegacySecurityPolicy is enabled and must be turned off in the Microsoft.Dynamics.Nav.Server.exe.config file.

To fix this perform this change as well:

  • Backup this file first and then edit: “C:\Program Files\Microsoft Dynamics 365 Business Central\130\Service\Microsoft.Dynamics.Nav.Server.exe.config” and change true to false on line 36, so after changing it should look like this:
<NetFx40_LegacySecurityPolicyenabled="false"/>

Now restart the Server Instance to load the changes. Now open VS Code again or if opened already now press F5 to publish an extension on page 22. That’s it. If everything went well you should see something like this:

2019-01-21 21_25_33-bcs01 op irasoelbaks - verbinding met virtuele machine

This confirms the AL Development environment is installed and configured correctly.

Is the publishing failing? Troubleshooting steps:

  1. Is the server instance started?
  2. Is the development endpoint enabled?
  3. The service name matches the one specified in the URL?
  4. The port number matches the one specified in the URL?
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s