B1 DevKit for SAP Business OneBuild, run and debug SAP Business One add-ons (C# and VB.NET, .NET Framework) from VS Code, with the F5 workflow you know from other IDEs.
Features
Requirements
Getting started
To start from scratch, run SAP B1: New add-on project from the Command Palette: the commands are available in any Windows workspace, even an empty folder. The project gets a Form commands are described in Forms. Other commands (Command Palette, category "SAP B1"): Select active add-on, Build add-on, Rebuild add-on, Start debugging, Run without debugging, Attach to running add-on, Start SAP Business One client, Show log. Guide: your first add-on with a formThis walkthrough goes from an empty folder to a running add-on with its own form. It takes about ten minutes. 1. Create the add-on
2. Create a form
3. Design the form
4. Handle the events in C#Select an item and open the Events tab: tick an event to create its handler in the code-behind, Open handler jumps to the method. Double-clicking an item on the form creates the handler of its default event (for a button, the click). Write your code in the handler, for example:
5. See it in SAP Business One
The rest of the features (system forms and UDO forms, capture from the client, legacy FormsB1 DevKit edits the form files of a SAP Business One add-on and keeps them in step with the C# code. Form files and the XML editor
Forms treeThe SAP B1 Forms view (Explorer) lists the add-ons and their forms, with an icon per category. From it: open the XML, the designer or the code-behind, preview, reveal in Explorer, convert a In the Explorer, the code-behind ( DesignerA
Alignment guides and distribution. While you drag or resize an item with the mouse, its edges and centers snap to those of the other items of the pane and to the edges of the form when they are within 4 px, as the snaplines of the Visual Studio designer: left with left, right with right, center with center, and an edge against the opposite one to put two fields side by side. Pink guide lines show the alignment while you drag. Where no guide is near, the grid applies as before. Hold Alt to place the item freely, without guides or grid; the arrow keys always move by 1 px (10 px with Shift). The guides are set by Columns of matrices and grids. Edit columns… in the properties panel opens a dialog with the columns on the left and the selected column on the right: its attributes, its data binding (matrix columns: DB table, user data source or DataTable column) and, for combo-box columns, its ValidValues. OK applies all the changes as one undo step; Cancel or Esc discards them. Code-behind sync. When the A The designer and the XML editor work on the same document: a change in one is shown in the other. Live previewPreview form in SAP Business One loads the form in the running client, so you see it with the real controls:
Errors reported by the client are shown as diagnostics on the file. With Capture and wizards
UDO forms from a companyYou can bring the form of a UDO into a workspace folder, edit it in the designer and save it back, with the SAP Business One client or, without it, through the Service Layer.
|
| Setting | Default | Description |
|---|---|---|
sapb1.forms.generateB1s |
auto |
auto generates the .b1s unless the project has its own generator (a Target or Exec naming .b1s or B1SGenerator); always generates it anyway; never does not generate it. |
sapb1.forms.previewOnSave |
true |
Reload the live preview when the file is saved and 500 ms after each change in the designer. |
sapb1.forms.designer.snap |
5 |
Grid of the designer in pixels (0 to 50). 0 turns snapping off. |
sapb1.forms.designer.guides |
true |
Alignment guides while dragging and resizing with the mouse (hold Alt to place freely). |
sapb1.serviceLayer.connections |
[] |
Connections to the Service Layer: name, url, companyDb, user. Passwords are never stored here. |
Limits
- VB.NET code-behind is not supported: a form of a VB.NET add-on can be edited, but no VB class is generated or synchronised.
- Menus with attributes (
MenuItemAttribute) are not supported: the SAP runtime does not load them from the.b1s. - Edit Active Form (sending the form open in the client to the editor) is not supported; use Capture form from SAP Business One client instead.
- The fidelity of the designer is approximate, not pixel-perfect: check the result with the live preview.
- The live preview, the capture and the wizards need the 64-bit SAP Business One client, running and logged in to a company. With a 32-bit client they are disabled, with a message.
- A command-line MSBuild target that generates the
.b1sis not available: the file is written by the extension after its own builds.
Add-on package
SAP B1: Package add-on (sapb1.package) turns the active add-on into the zip that the SAP Business One Extension Manager imports (lightweight installation). It is written by B1 DevKit itself: the SAP packaging tools are not needed.
What the command does:
- Takes the
.ardregistration file of the project (a.ardin the project folder or its subfolders, skippingbin,obj,node_modules,packagesand.git). With several, it always asks which one to use, the last one used first. With none, a wizard asks the extension name, partner, partner namespace, contact and minimum SAP Business One version, and writes<ExtName>.ardnext to the project (an existing file is never overwritten). If the.ardhas errors (those the editor reports, or noAddons/Addonelement), the command opens it and stops before building. - Builds the add-on in the configuration
sapb1.package.configuration(Releaseby default). For each platform insapb1.package.platformsthe build output must run with that bitness:x64needsPlatformTargetx64, or AnyCPU without Prefer32Bit;x86needs x86, or AnyCPU with Prefer32Bit. A platform that the main build does not fit is built on its own, and the command stops if that would overwrite the output of another platform or if the bitness still does not fit. - If the project has forms (UserForm or SystemForm), requires the
<AssemblyName>.b1snext to the executable, newer than the executable and containing every form. A missing, stale or incomplete.b1sis regenerated, unlesssapb1.forms.generateB1sisnever, orautoand the project has its own.b1sgenerator (then the message asks you to rebuild); if forms are still missing, the package is not created and the message lists them. - Reads the version from the executable (its
FileVersion, as it is written); if the platforms have different versions, it stops. - Collects the whole output folder, minus the exclusions, and shows a preview: name, version, number of files, platforms, size and destination. Show files lists them in a read-only document.
- Writes
<ExtName>_v<version>.zipinsapb1.package.outputFolder(a temporary file, then renamed). An existing zip is replaced only after you confirm.
The zip contains the completed .ard (version, add-on name, executable name, MD5 and SHA-256 signatures of the executable, and the list of files) and the files under X64Client and/or X86Client.
Editing the .ard
*.ard files open with the sapb1-ard language: XML with diagnostics (invalid XML, root other than AddOnRegData, SchemaVersion other than 3.0, empty ExtName, Partner or Partnernmsp, values outside the allowed lists) and completion of the values of SlientInstallation, SlientUpgrade, MultipleVersion and DBType. The .ard of the project is never modified by the command; only the copy inside the zip is completed.
Settings
| Setting | Default | Description |
|---|---|---|
sapb1.package.platforms |
["x64"] |
Platforms of the package: x64 (folder X64Client) and/or x86 (folder X86Client). |
sapb1.package.configuration |
Release |
Build configuration of the add-on in the package. |
sapb1.package.exclude |
logs/**, app.publish/**, **/*.vshost.*, **/*.zip, **/*.log, **/*.ard |
Files of the output folder left out of the package (globs relative to it; \ and / are both separators; an invalid pattern stops the command before building). The executable is always included, and so is its .b1s when the project has UserForms or SystemForms. |
sapb1.package.outputFolder |
"" |
Folder of the zip, relative to the project folder or absolute. Empty means bin\AddonPackages. |
The final check is the import of the zip in the Extension Manager of a test company: B1 DevKit builds the package in the observed format, but only the Extension Manager can confirm that it accepts it. Classic installer packages, digital signing and per-file actions are not covered.
Launch configuration reference
Debugger type: sapb1.
{
"type": "sapb1",
"request": "launch",
"name": "Debug SAP B1 add-on"
}
launch
| Property | Type | Default | Description |
|---|---|---|---|
project |
string | active add-on | Add-on project (.csproj or .vbproj). Relative paths start from the workspace folder. A project that is not detected as an add-on (for example one that reaches SAP only through a referenced library) is accepted if it builds an executable (OutputType Exe or WinExe). |
solution |
string | sapb1.solution or auto-detect |
Solution used to build the add-on. |
configuration |
string | sapb1.configuration (Debug) |
Build configuration. |
platform |
string | sapb1.platform (auto) |
Build platform. |
connectionString |
string | sapb1.connectionString |
Connection string passed to the add-on as its first argument. |
args |
string[] | [] |
Arguments passed after the connection string. |
build |
boolean | true |
Build before launching. |
checkClient |
boolean | sapb1.clientCheck (true) |
Check that the SAP Business One client is running. |
justMyCode |
boolean | true |
Debug only user code. |
env |
object | {} |
Environment variables for the add-on. |
cwd |
string | folder of the executable | Working directory. |
Any other property is passed unchanged to the .NET Framework debugger, so its options can be set here.
attach
| Property | Type | Default | Description |
|---|---|---|---|
processId |
string or integer | ${command:sapb1.pickAddonProcess} |
Process ID of the add-on. The default shows a list of running add-ons. |
Settings
| Setting | Default | Description |
|---|---|---|
sapb1.msbuildPath |
"" (auto) |
Full path to MSBuild.exe. |
sapb1.clientPath |
"" (auto) |
Full path to SAP Business One.exe. |
sapb1.connectionString |
SAP development string | Connection string passed to the add-on. |
sapb1.solution |
"" (auto) |
Solution (.sln or .slnx) used to build the add-on, relative to the workspace folder. |
sapb1.configuration |
Debug |
Build configuration. |
sapb1.platform |
auto |
Build platform. auto prefers the solution's x64 platform, then Any CPU. |
sapb1.build.forcePortablePdb |
true |
Force DebugType=portable so the debugger can load symbols. |
sapb1.build.extraArgs |
[] |
Extra arguments appended to the MSBuild command line. |
sapb1.clientCheck |
true |
Check that the SAP Business One client is running before debugging. |
sapb1.forms.generateB1s |
auto |
Generate the .b1s form package after a build (see Forms). |
sapb1.forms.previewOnSave |
true |
Reload the live preview on save (see Forms). |
sapb1.forms.designer.snap |
5 |
Grid of the form designer in pixels (see Forms). |
sapb1.forms.designer.guides |
true |
Alignment guides in the form designer (see Forms). |
sapb1.serviceLayer.connections |
[] |
Service Layer connections (name, url, companyDb, user); passwords are kept in the secret storage (see UDO forms from a company). |
sapb1.package.platforms |
["x64"] |
Platforms of the Extension Manager package (see Add-on package). |
sapb1.package.configuration |
Release |
Build configuration of the package. |
sapb1.package.exclude |
see above | Files of the output folder left out of the package. |
sapb1.package.outputFolder |
"" |
Folder of the package zip (bin\AddonPackages when empty). |
How building works
The extension finds the solution (.sln or .slnx) that contains the add-on and builds the add-on's target inside it with MSBuild, so referenced projects are built with the configuration and platform the solution maps for them. Without a solution, the project is built directly. Packages are restored (-restore, including packages.config).
The Build add-on and Rebuild add-on commands check MSBuild and the solution configuration first, so that problems such as a missing MSBuild are reported with their actions (Configure path, Download Build Tools).
Debug symbols are forced to portable PDBs (-p:DebugType=portable) without touching your project files, because the debugger cannot read full PDBs. The command line, the chosen solution and platform, and the reason for any block are written to the SAP B1 output channel (SAP B1: Show log).
Build tasks in tasks.json
{
"type": "sapb1",
"action": "build", // or "rebuild"
"project": "${workspaceFolder}/Addon/Addon.csproj", // optional: the active add-on otherwise
"solution": "…", // optional
"configuration": "Debug", // optional
"platform": "x64" // optional
}
Variables are substituted, and relative project and solution paths start from the folder of the task. A project that does not exist makes the build fail with an error naming the path: the task never falls back to another add-on.
Limitations
- 32-bit add-ons cannot be debugged: the .NET Framework debugger in VS Code supports 64-bit processes only. The extension explains the cause and offers to open the project file.
- The
csharp.debug.*settings are not applied. Put debugger options in thesapb1launch configuration. - T4 templates are not regenerated.
- Restart rebuilds the add-on only when it is a detected add-on and the launch configuration has no
solution,configurationorplatformoverrides (and nopreLaunchTaskof its own); otherwise it relaunches the existing executable. - If
launch.jsonhas an entry with the same name as the running session but different content (for example after editing it), Restart prepares the launch again before stopping the session, so it asks to terminate the add-on that is still running. - In
.slnxsolutions, managed projects (.csproj/.vbproj) without an explicit<Platform>override build asAnyCPUwhatever the solution platform, as MSBuild does.
License
MIT (see the LICENSE file included in the extension). Copyright (c) 2026 ADeploy.




