FoxBridge
FoxBridge brings the .NET ecosystem into Visual FoxPro. You instantiate any .NET class, call its methods, read and write properties, work with generic collections (List<T>, Dictionary<K,V>), invoke static members and consume async/await, all with the dot syntax of your usual VFP code. No COM, and nothing to register.
In this section
- Installation: The files to copy, the .NET runtime and activating the license.
- Quick Start: Your first .NET object from VFP in under five minutes.
- Examples: Twenty progressive examples, from StringBuilder to HttpClient and async/await.
- API Reference: The FoxBridge class and the collection proxies, method by method.
How it works
Two layers and a single class. FoxBridge.prg is the API you see from VFP; underneath, x86\FoxBridgeNE.dll starts the .NET runtime and forwards the calls, leaning on FoxBridge.dll, Nexum.dll and the two .json files that sit beside it. All five files in that subfolder travel together.
* Initialize and activate (the two lines go together)
loBridge = NEWOBJECT("FoxBridge", "FoxBridge.prg")
IF !loBridge.Activate(lcJwt)
? loBridge.GetLastError()
RETURN
ENDIF
* And from here on, .NET with dot syntax
loSB = loBridge.Create("System.Text.StringBuilder", "Hello ")
loSB.Append("from .NET!")
? loSB.ToString() && "Hello from .NET!"loBridge.Activate() at start-up, and the check sits at the start of all fifty entry points of the engine: without activating, not even a StringBuilder. If maintenance has expired the product keeps working; what expires is the right to new versions. What you get
- Instantiation of any .NET type, with up to ten constructor parameters
- Generic collections:
List<T>,Dictionary<K,V>and arrays, 1-based like VFP - Static members: class methods, properties and fields, through
Static() - Enums read by name from the static proxy (
loFileMode.Create), instead of remembering the number - Automatic overload resolution and type coercion from VFP to .NET
async/awaittransparently: the task is awaited and returns its result- Loading your own compiled DLLs, with
LoadAssembly() - Nine ready-made satellites and a tutorial with ClosedXML and iText, inside the package itself (the table below)
The nine satellites
They ship inside the package, under Satellites\, and they are VFP .prg files you can read and change: each wraps a slice of .NET in FoxPro-named functions, so you do not write Create() by hand. Load one with SET PROCEDURE TO fb_http ADDITIVE and hand them the bridge once, with FB_SET_INSTANCE(loBridge), which they all share.
| Satellite | What it wraps |
|---|---|
fb_http | Requests with HttpClient: GET, POST, PUT and DELETE, the status code with HEAD, and download to a file. |
fb_json | Read JSON by dot-path on top of System.Text.Json, validate and pretty-print it; and build it with plain-VFP functions. |
fb_crypto | Text and file hashes, HMAC, AES (text and files), RSA (keys, encrypt, sign and verify), secure random values and Base64. |
fb_email | SMTP mail with SmtpClient: set the server and the sender, send, and validate an address. |
fb_io | ZIP (create, extract, add and list), files (copy, move, delete, size), folders and paths. |
fb_process | Launch processes and collect their exit code or what they print, list and kill them, open a file or a URL with its program, and environment variables. |
fb_dialogs | Message box, open and save file, folder picker and the clipboard. It is the only one that needs the .NET Desktop Runtime, because it uses WinForms. |
fb_aixl | Runs AIXL scripts over VFP cursors. It needs the AIXL DLL and license, which are not on sale today. |
fb_aixl_easy | The same AIXL layer as one-line functions, such as AIXL_CLASSIFY(). Same requirement as fb_aixl. |
Requirements
| Component | Requirement |
|---|---|
| Visual FoxPro | VFP 9.0 SP2 (x86). The package also ships x64\ for 64-bit VFP Advanced |
| Windows | Windows 10 or 11 |
| .NET | Runtime 8.0 or later, in the architecture of the process: with VFP 9, the x86 one |
| COM | None. No registration, no installer and nothing written to the Windows registry |