Project Title: Cross Platform .NET Bindings for UNO API
Contributor: Ritobroto Mukherjee (GitHub, LinkedIn)
Organization: LibreOffice
Mentors: Mr. Hossein Nourikhah, Mr. Thorsten Behrens
Patches Submitted: Gerrit
The UNO API allows developers to write code that works with LibreOffice, allowing programmatic control over the entire suite. This provides a robust platform for creating extensions, automations, and integrations with other software systems, whether the task at hand is manipulating documents, spreadsheets, presentations, databases, or drawing files.
This project aims to modernize the integration of UNO and the .NET ecosystem, by bringing support for .NET 8. This includes cross-platform support, NuGet packaging, modern syntax, and general quality-of-life improvements for the end user and code alike.
The LibreOffice project already included bindings for CLI, which allowed integration with C# and VB.NET code. However, these were over 20 years old and only supported C# 1 and .NET Framework 4, while the latest versions are C# 12 and .NET 8. These bindings were undocumented and relied heavily on C++/CLI to work, which has limited support on .NET 8 and is Windows-only. Additionally, the bindings were distributed as loose .dll files, which is not the current best practice.
The shortcomings of the outdated bindings mentioned above called for a major rewrite. Everything from the code generator to the marshalling was re-implemented in standard, cross-platform C# to ensure maximum compatibility. .NET Standard 2.0 was selected as baseline to support both .NET Framework 4 and .NET 8, so that any existing users of the CLI bindings could have an easier transition.
The newer bindings feature cleaner integration with the build system, unit testing support, cross-platform support, a decent number of ported examples, a NuGet .nupkg file for easy distribution, and many quality-of-life code changes such as generics.
Milestone | Deliverable | Status | Patches |
---|---|---|---|
Build System Integration | Integrated the dotnet build tool with LibreOffice's GNU Make based buildscripts to allow building .NET code. | Complete | 166380, 169656, 170168 |
Netmaker (Code Generator) | Created the netmaker component to dynamically generate C# code stubs from .idl files to supply type information. | Complete | 168710, 171706 |
CI Integration | Added .NET SDK to the CIs to allow continuous testing of added .NET code. | Complete | 168272 |
Unit Test Integration | Extended the build system integration to allow running unit tests written in .NET from GNU Make. | Complete | 168956 |
NuGet Package | Added scripts to bundle up produced bindings into a .nupkg file for easy end user consumption. | Complete | 170172 |
Out-of-process Bridging | Wrote proxy classes and marshalling code to allow creating objects and calling functions in UNO from .NET code. | Complete | 170916 |
Porting Examples | Ported existing Java, C++ and Python UNO code samples to C#, F# and VB.NET to demonstrate new bindings. | Complete | 172778 |
Although GSoC is over, I look forward to contributing to LibreOffice and refining the bindings further. Building on the completed milestones, future contributions could address:
- Adding support for authoring components in .NET code, and using them from LibreOffice and other language bindings (in-process bridge).
- Writing and porting more examples, tests, and documentation to help both developers and end users familiarize themselves with the new bindings.
- Dropping .NET Framework support to transition fully to .NET 8 and leverage the latest .NET code features and syntax.
- Developing a fully managed version of the bindings in .NET code only, simplifying distribution and eliminating the need for native interop and a full LibreOffice installation.
I would like to thank my mentors, family and friends for their constant support. I also extend my gratitude to the LibreOffice project and the Google Summer of Code program for this incredible opportunity.
Great news!
And thanks for your great work for LibreOffice project!