CW.RevitAppFramework.2019 26.6.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package CW.RevitAppFramework.2019 --version 26.6.1
                    
NuGet\Install-Package CW.RevitAppFramework.2019 -Version 26.6.1
                    
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="CW.RevitAppFramework.2019" Version="26.6.1">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CW.RevitAppFramework.2019" Version="26.6.1" />
                    
Directory.Packages.props
<PackageReference Include="CW.RevitAppFramework.2019">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 CW.RevitAppFramework.2019 --version 26.6.1
                    
#r "nuget: CW.RevitAppFramework.2019, 26.6.1"
                    
#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 CW.RevitAppFramework.2019@26.6.1
                    
#: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=CW.RevitAppFramework.2019&version=26.6.1
                    
Install as a Cake Addin
#tool nuget:?package=CW.RevitAppFramework.2019&version=26.6.1
                    
Install as a Cake Tool

CW.RevitAppFramework

Overview

CW.RevitAppFramework is a framework for building WPF-based extensions for Autodesk Revit. It provides a structured MVVM architecture with built-in support for executing commands in Revit context, managing UI resources, and handling dependencies across Revit versions.

Features

  • Multi-version support: compatible with Revit 2019 through 2026
  • MVVM pattern implementation: built on MVVMFluent.WPF
  • CQRS pattern: command and query segregation for clear operations
  • External event handler: safe execution of Revit operations from UI threads
  • Resource management: shared theme and resource handling
  • Dependency injection: service registration and resolution
  • WPF UI integration: modern UI components via WPF-UI

Architecture

Core Components

  • RevitContext: wraps Revit's UIApplication for document/model access
  • ExternalEventExecutor: executes commands and queries in Revit API context
  • AppExternalEventHandler: manages queued operations executed in Revit
  • ServiceFactory: creates and configures dependency injection services

MVVM Components

  • RevitViewModelBase: base class for view models with Revit command execution
  • RevitCommandFluent: fluent API for defining and executing Revit operations
  • ResourceInjectionBehavior: XAML behavior for applying global styles

Installation

Add the package that matches your Revit version:

<PackageReference Include="CW.RevitAppFramework.<RevitVersion>" Version="26.*">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

Example:

<PackageReference Include="CW.RevitAppFramework.2026" Version="1.*" />

Usage

1. Initialize Services

Set up your service container and initialize framework services:

var provider = ServiceFactory.Create(context.UIApplication, services =>
{
	services
		.RegisterAppServices()
		.AddSingleton(args);
});

2. Create View Models

Derive view models from RevitViewModelBase to access Revit command execution:

public class HomeViewModel(IExternalEventExecutor externalEventExecutor)
	: RevitViewModelBase(externalEventExecutor)
{
	public string? DocumentTitle
	{
		get => Get<string?>();
		set => Set(value);
	}

	public IAsyncFluentCommand GetDocumentTitleCommand =>
		Send<GetDocumentTitleQuery, string>()
		.Then(title => DocumentTitle = title);
}

3. Define Commands and Queries

Implement CQRS handlers for Revit operations:

public class GetDocumentTitleQuery : IQuery<string>
{
}

public class GetDocumentTitleQueryHandler : IQueryHandler<GetDocumentTitleQuery, string>
{
	private readonly RevitContext _revitContext;

	public GetDocumentTitleQueryHandler(RevitContext revitContext)
	{
		_revitContext = revitContext;
	}

	public string Execute(GetDocumentTitleQuery query, CancellationToken cancellationToken)
	{
		return _revitContext.Document?.Title ?? "No document open";
	}
}

4. Show the Main Window

Launch your application window:

WindowHandler.ShowWindow<MainWindow>(provider, IntPtr.Zero);

Resource Management

Apply global styles/resources in XAML:

<UserControl
	resources:ResourceInjectionBehavior.InjectResources="True"
	xmlns:resources="clr-namespace:RevitAppFramework.Resources">
	
</UserControl>

Versioning Support

  • Set build configuration per Revit version (for example Debug 2022)
  • Use conditional symbols for version-specific code (for example #if R2022)
  • Reference version-specific Revit API assemblies through package configuration

Dependencies

  • WPF-UI
  • MVVMFluent.WPF
  • Microsoft.Extensions.DependencyInjection

License

MIT License

For more information, visit Tools by AEC Wiki

Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
26.7.0-PullRequest4.24 35 5/29/2026
26.7.0-PullRequest4.2 45 3/19/2026
26.7.0-beta.23 49 5/29/2026
26.7.0-beta.1 127 3/19/2026
26.6.1 171 3/2/2026
26.6.1-PullRequest3.5 29 3/2/2026
26.6.1-PullRequest3.4 28 3/2/2026
26.6.1-PullRequest3.3 33 3/2/2026
26.6.1-PullRequest3.2 26 3/2/2026
26.6.1-beta.4 125 3/2/2026
26.6.1-beta.3 124 3/2/2026
26.6.1-beta.2 124 3/2/2026
26.6.1-beta.1 126 3/2/2026
26.6.0 191 2/27/2026
26.5.9-PullRequest2.2 29 2/27/2026
26.5.8 170 2/26/2026
26.5.8-PullRequest1.3 27 2/26/2026
26.5.8-PullRequest1.2 29 2/26/2026
26.5.7 175 2/26/2026
26.5.6 177 2/26/2026
Loading failed