Tmds.DBus.SourceGenerator
0.0.22
dotnet add package Tmds.DBus.SourceGenerator --version 0.0.22
NuGet\Install-Package Tmds.DBus.SourceGenerator -Version 0.0.22
<PackageReference Include="Tmds.DBus.SourceGenerator" Version="0.0.22"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Tmds.DBus.SourceGenerator" Version="0.0.22" />
<PackageReference Include="Tmds.DBus.SourceGenerator"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Tmds.DBus.SourceGenerator --version 0.0.22
#r "nuget: Tmds.DBus.SourceGenerator, 0.0.22"
#:package Tmds.DBus.SourceGenerator@0.0.22
#addin nuget:?package=Tmds.DBus.SourceGenerator&version=0.0.22
#tool nuget:?package=Tmds.DBus.SourceGenerator&version=0.0.22
Tmds.DBus.SourceGenerator
A roslyn source generator targeting the Tmds.DBus.Protocol API
Introduction
This source generator eliminates the usage of reflection to be trimmer- and AOT-friendly. For further documentation of Tmds.DBus and DBus in general, see https://github.com/tmds/Tmds.DBus#readme.
Usage
Note
This Source Generator targets the
Tmds.DBus.ProtocolAPI, which means you have to explicitly install said package.
Either install the NuGet package Tmds.DBus.SourceGenerator or clone the git repository and add a project reference to
the source generator in your .csproj
<ItemGroup>
<ProjectReference Include="./Tmds.DBus.SourceGenerator/Tmds.DBus.SourceGenerator/Tmds.DBus.SourceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
<Import Project="./Tmds.DBus.SourceGenerator/Tmds.DBus.SourceGenerator/Tmds.DBus.SourceGenerator.props" />
Then add the XML definitions as AdditionalFiles to your project.
Depending on whether you want to generate a Proxy or a handler, set the DBusGeneratorMode to either Proxy or Handler, respectively.
<ItemGroup>
<AdditionalFiles Include="DBusXml/DBus.xml" DBusGeneratorMode="Proxy" />
<AdditionalFiles Include="DBusXml/StatusNotifierItem.xml" DBusGeneratorMode="Handler" />
</ItemGroup>
Now you can instantiate the generated proxy class and use it like with the traditional Tmds.DBus. For handlers, create a new class and inherit from the generated one and implement its abstract methods.
Examples
For example, you may take a look at some projects that use this source generator:
How to get DBus interface definitions
DBus interface definitions are written in XML. There are mainly two ways for getting those:
- Finding the source online somewhere... This could be a GitHub repo or some obscure website from the mid-2000s (at your own risk).
- Dumping the definition via introspection
If you have a service running on your system from which you want to extract the definition, you may use
busctl, e.g.:
To list available services:
To inspect the object tree of a service:busctl list
To dump the XML definition of the interface:busctl tree <service name>busctl introspect <service name> /path/to/object --xml-interface
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (4)
Showing the top 4 popular GitHub repositories that depend on Tmds.DBus.SourceGenerator:
| Repository | Stars |
|---|---|
|
AvaloniaUI/Avalonia
Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
|
|
|
AvaloniaUI/Avalonia.Labs
Experimental Controls for Avalonia
|
|
|
MATRIX-feather/LLin
从mfosu中分离出来的下载加速 & 游戏内音乐播放器
|
|
|
ZoeyErinBauer/Shelly-ALPM
Pacman alternative for ArchLinux, designed with you in mind.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.22 | 7,239 | 10/13/2025 |
| 0.0.21 | 27,058 | 2/28/2025 |
| 0.0.20 | 7,715 | 10/9/2024 |
| 0.0.19 | 37,190 | 8/18/2024 |
| 0.0.18 | 71,311 | 7/18/2024 |
| 0.0.17 | 4,661 | 6/8/2024 |
| 0.0.16 | 3,449 | 4/18/2024 |
| 0.0.15 | 56,098 | 1/31/2024 |
| 0.0.14 | 337 | 1/28/2024 |
| 0.0.13 | 6,030 | 11/18/2023 |
| 0.0.12 | 310 | 11/15/2023 |
| 0.0.11 | 6,761 | 9/12/2023 |
| 0.0.10 | 12,858 | 8/31/2023 |
| 0.0.8 | 10,147 | 5/25/2023 |
| 0.0.7 | 2,471 | 5/5/2023 |
| 0.0.6 | 1,189 | 5/4/2023 |
| 0.0.5 | 4,717 | 3/28/2023 |
| 0.0.4 | 35,851 | 3/14/2023 |
| 0.0.3 | 446 | 3/13/2023 |
| 0.0.2 | 4,856 | 2/20/2023 |