How to: Install and deploy WKL Office JSON
Make JDoc and the other JSON classes available to VBA on a development PC and on the PCs of the
users of an application - without the source code and without .NET.
Solution overview
- One file per bitness.
Wkl.Office.JSON.dllis a native COM server that carries its own runtime: no .NET installation is needed on any PC. - Bitness of Office. 32-bit Office needs the
x86file, 64-bit Office thex64file; what counts is Office, not Windows (File › Account › About Access). - Registration per Windows user with the
regsvr32of the same bitness and/n /i:user, no administrator rights. - Reference WKL Office JSON 1.2 in the VBA project, or late binding with
CreateObject("WklJSON.JDoc").
Implementation
- Copy
Wkl.Office.JSON.dllof the release folderx86(32-bit Office) orx64(64-bit Office) to a local folder that stays, for example%LOCALAPPDATA%\WKL\Office JSON\2.0\x86. The.pdband.xmlfiles beside it are debug symbols and documentation; they are not needed. Close Access and register for the current Windows user. For 32-bit Office:
%windir%\SysWOW64\regsvr32.exe /n /i:user "%LOCALAPPDATA%\WKL\Office JSON\2.0\x86\Wkl.Office.JSON.dll"
For 64-bit Office use
%windir%\System32\regsvr32.exeand thex64file. Add/sin scripts to suppress the message box; to remove the registration, add/u.In the VBA editor choose Tools › References and tick WKL Office JSON 1.2. Check in the Immediate window:
? CreateObject("WklJSON.JDoc").LoadJson("{""a"": 1}")It prints
True.
On the PCs of the users repeat steps 1 and 2 for every Windows user who starts the application, for example from a logon script; the database keeps its reference. Build an ACCDE on a PC where the same file is registered.
With the starter of WKL Bootstrapper
From release 1.0.2 the package carries registration.json beside Wkl.Office.JSON.dll in x86
and x64: the per-user registration as data. The starter of WKL Bootstrapper registers
WKL Office JSON from it for each Windows user, without administrator rights and without
regsvr32, keeps it under the release (2.0.0) in the user's profile and removes it when no
installed application needs it any more. A package from 2.0.0 on needs the starter 2.3.1 or later; together with WKL
Forms Object Library 2.0 it needs the starter 3.1 or later. From WKL Bootstrapper 3.0 on, the starter program is
Wkl.Bootstrapper.exe; before, it was Wkl.Access.Bootstrapper.exe.
- Create the project of the starter with the template
json(withaccessandcomponentsfor an Access application with WKL controls):/new-project ... /template access,components,json. - Copy the folders
x86andx64of the release package, each with itsregistration.json, into the folderjsonof the delivery folder, as the template says. - Deliver as described for the starter (code wiki WKL-Access-Bootstrapper, pages “How to: Create a project from templates” and “The installer of the bootstrapper 2.0”).
The packages 1.0 and 1.0.1 have no registration.json; their Wkl.Access.JSON.dll reports the
version 0.1.0. Take 1.0.2 or later for a delivery through the starter.
Up to release 1.0.3 the library was called WKL Access JSON, its file Wkl.Access.JSON.dll and its type library
WKL Access JSON 1.0. A reference to it resolves to WKL Office JSON 1.2 without compiling again: the
library identifier, the ProgIDs and every member are the same. An application delivered with 1.0.x keeps its
file; where both releases are installed, the starter registers the newer one.
Remarks
Checking the package. Every program file of the package (EXE and DLL) carries the Authenticode signature of EMSR DATA, D.O.O. with a time stamp, and
SHA256SUMSlists the SHA-256 checksum of every file.sbom.cdx.jsonis the software bill of materials (CycloneDX 1.6): every file of the package and the parts of other manufacturers that NativeAOT links into the DLL (the .NET runtime, the Visual C++ runtime library), each with version and licence. Before you register, check the signature and the checksums in the package folder:Get-AuthenticodeSignature x86\Wkl.Office.JSON.dll | Format-List Status, SignerCertificate Get-Content SHA256SUMS | ForEach-Object { $hash, $file = $_ -split ' ', 2; if ((Get-FileHash -LiteralPath $file).Hash -ne $hash) { "changed: $file" } }
Statusmust beValidand the signerEMSR DATA, D.O.O.; the second command prints nothing when every file is unchanged.- No installer of its own. The package holds no MSI or setup program: install by hand as above, or deliver it with your application through the starter of WKL Bootstrapper, which registers it for each user.
- The folder must stay. The registration points to the file at its place; after moving it, register again.
- Every Windows user registers once.
/n /i:userwrites only toHKEY_CURRENT_USER; so does the starter. - One file, no
Wkl.Office.Json.Core.dll. NativeAOT links the core intoWkl.Office.JSON.dll; the package carries only the core's.pdband.xml. - Wrong bitness shows as run-time error 429 or a reference marked MISSING; register the file of the Office bitness.