VolocyNazad.Revit.Events 2025.0.9

dotnet add package VolocyNazad.Revit.Events --version 2025.0.9
                    
NuGet\Install-Package VolocyNazad.Revit.Events -Version 2025.0.9
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VolocyNazad.Revit.Events" Version="2025.0.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VolocyNazad.Revit.Events" Version="2025.0.9" />
                    
Directory.Packages.props
<PackageReference Include="VolocyNazad.Revit.Events" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add VolocyNazad.Revit.Events --version 2025.0.9
                    
#r "nuget: VolocyNazad.Revit.Events, 2025.0.9"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package VolocyNazad.Revit.Events@2025.0.9
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=VolocyNazad.Revit.Events&version=2025.0.9
                    
Install as a Cake Addin
#tool nuget:?package=VolocyNazad.Revit.Events&version=2025.0.9
                    
Install as a Cake Tool

Revit.Events

Revit 2021.1.9, 2023, 2025 License: MIT VolocyNazad

Service implementation for raising external events in the Revit API.

Revit.Events is a set of services with support for DI containerization, for queuing operations initiated outside the Revit API context and executing them inside the Revit API context.

More about how the mechanism works: RevitApi

Installation

dotnet add package VolocyNazad.Revit.Events

The package is built per Revit version: the assembly is tied to a specific Revit version — choose the package version matching your Revit API version.

Features

  • IExternalEvent — synchronously queues an action on Revit's external event queue, returning an ExternalEventRequest immediately.
  • IAsyncExternalEvent — the async version: returns a Task that completes once the action has run inside Revit (including with an error, if the action threw an exception).
  • ExternalEventOptions.AllowDirectInvocation — if the call is already happening inside the Revit API context, the action runs immediately, without going through Revit's external event queue.

DI Registration

using Revit.Events.DI;

services.AddEvents();

Registers IExternalEvent and IAsyncExternalEvent as singleton services.

Usage

Synchronous

public class MyCommand
{
    private readonly IExternalEvent _externalEvent;

    public MyCommand(IExternalEvent externalEvent) => _externalEvent = externalEvent;

    public void Run()
    {
        _externalEvent.Raise(uiApplication =>
        {
            // code that requires the Revit API context
        });
    }
}

Asynchronous

public class MyCommand
{
    private readonly IAsyncExternalEvent _asyncExternalEvent;

    public MyCommand(IAsyncExternalEvent asyncExternalEvent) => _asyncExternalEvent = asyncExternalEvent;

    public async Task RunAsync()
    {
        await _asyncExternalEvent.Raise(uiApplication =>
        {
            // code that requires the Revit API context
        });
    }
}

AllowDirectInvocation

_externalEvent.Raise(uiApplication =>
{
    // ...
}, ExternalEventOptions.AllowDirectInvocation);

If the code is already running inside the Revit API context (for example, called from another external event), the action executes immediately — without being queued and waiting for Revit's next "tick".

Supported Revit Versions

Revit 2021.1.9 and 2023.0.0 use net48; Revit 2025.0.0 uses net8.0-windows.

Development

The matrix of Revit versions is defined by the build configurations (Debug_<year>.<...> / Release_<year>.<...>) in src/Revit.Events/Revit.Events.csproj and Toolkit.Revit.Events.slnx. The package version is computed automatically from git tags via MinVer, tied to the Revit year.

Tests live in tests/Revit.Events.Tests. Part of the logic (working with real Revit-typed objects) cannot be tested outside of the Revit process — such tests are marked [Fact(Skip = "...")].

dotnet build --configuration "Release_2025.0.0"
dotnet test --configuration "Release_2025.0.0"

Changelog

See CHANGELOG.md.

License

MIT

Development documentation

Contributing

CONTRIBUTING.md before submitting changes.

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on VolocyNazad.Revit.Events:

Package Downloads
VolocyNazad.Revit.MediatR

Revit MediatR.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2025.0.9 107 9/21/2026
2025.0.8 129 9/6/2026
2025.0.7 138 8/13/2026
2025.0.6 138 6/11/2026
2023.0.9 98 9/21/2026
2023.0.8 121 9/6/2026
2023.0.7 123 8/13/2026
2023.0.6 130 6/11/2026
2021.0.9 91 9/21/2026
2021.0.8 120 9/6/2026
2021.0.7 124 8/13/2026
2021.0.6 133 6/11/2026