Autodesk Revit plugin project organized into multiple solution files that target versions 2023 - 2027.
- Prerequisites
- Solution Structure
- Project Structure
- Updating the API schema
- Building
- Publishing Releases
- Compiling a solution on GitHub
- Conditional compilation for a specific Revit version
- Managing Supported Revit Versions
- API references
- Learn More
Before you can build this project, you need to install .NET and IDE. If you haven't already installed these, you can do so by visiting the following:
| Folder | Description |
|---|---|
| build | ModularPipelines build system. Used to automate project builds |
| install | Add-in installer, called implicitly by the ModularPipelines build |
| source | Project source code folder. Contains all solution projects |
| output | Folder of generated files by the build system, such as bundles, installers |
| Folder | Description |
|---|---|
| Commands | External commands invoked from the Revit ribbon. Registered in the Application class |
| Models | Classes that encapsulate the app's data, include data transfer objects (DTOs). More details. |
| ViewModels | Classes that implement properties and commands to which the view can bind data. More details. |
| Views | Classes that are responsible for defining the structure, layout and appearance of what the user sees on the screen. More details. |
| Resources | Images, sounds, localisation files, etc. |
| Utils | Utilities, extensions, helpers used across the application |
Make sure you have the generator installed:
dotnet tool install Microsoft.OpenApi.Kiota --globalThen:
kiota generate --openapi "https://api.nablaflow.io/archiwind/openapi" --language CSharp --output .\ArchiWindRevitAddIn\Api\ --class-name HttpClient --namespace-name ArchiwindRevitAddIn.ApiWe recommend JetBrains Rider as preferred IDE, since it has outstanding .NET support. If you don't have Rider installed, you can download it from here.
-
Open JetBrains Rider
-
In the
Solutions Configurationdrop-down menu, selectRelease.R25orDebug.R25. SuffixR25means compiling for the Revit 2025. -
After the solution loads, you can build it by clicking on
Build -> Build Solution. -
Debugbutton will start Revit add-in in the debug mode.
Also, you can use Visual Studio. If you don't have Visual Studio installed, download it from here.
- Open Visual Studio
- In the
Solutions Configurationdrop-down menu, selectRelease.R25orDebug.R25. SuffixR25means compiling for the Revit 2025. - After the solution loads, you can build it by clicking on
Build -> Build Solution.
To build the project for all versions, create the installer and bundle, this project uses ModularPipelines
To execute your ModularPipelines build locally, you can follow these steps:
-
Navigate to your project directory. Open a terminal / command prompt and navigate to your project's root directory.
-
Run the build. Once you have navigated to your project's root directory, you can run the ModularPipelines build by calling:
Compile:
cd build; dotnet run
Create installer and bundle:
cd build; dotnet run -- pack
This command will execute the ModularPipelines build defined in your project.
Releases are managed by creating new Git tags. A tag in Git used to capture a snapshot of the project at a particular point in time, with the ability to roll back to a previous version.
The build system uses GitVersion.Tool to automatically determine the Release version based on the Git history and tags. If a tag is present on the current commit, the version will match the tag. If no tag is specified, the tool automatically generates a release version based on the branch name and commit history.
You can also specify a fixed version by setting the Version property in the build/appsettings.json file. This will override the version determined by GitVersion.Tool.
Tags can follow the format version or version-stage.n.date for pre-releases, where:
- version specifies the version of the release:
1.0.02.3.0
- stage specifies the release stage:
alpha- represents early iterations that may be unstable or incomplete.beta- represents a feature-complete version but may still contain some bugs.
- n prerelease increment (optional):
1- first alpha prerelease2- second alpha prerelease
- date specifies the date of the pre-release (optional):
25010120250101
For example:
| Stage | Version |
|---|---|
| Alpha | 1.0.0-alpha |
| Alpha | 1.0.0-alpha.1.20250101 |
| Beta | 1.0.0-beta.2.20250101 |
| Release | 1.0.0 |
Updating the changelog is optional. If you provide a changelog, the build system will use it for the release notes. If no entry is found for the current version, GitHub will automatically generate release notes based on your pull requests and commits.
To update the changelog manually:
- Navigate to the solution root.
- Open the file Changelog.md.
- Add a section for your version. The version separator is the
#symbol. - Specify the release number e.g.
# 1.0.0or# 25.01.01 v1.0.0, the format does not matter, the main thing is that it contains the version. - In the lines below, write a changelog for your version, style to your taste.
- Commit your changes.
JetBrains provides a handy UI for creating a tag, it can be created in a few steps:
-
Open JetBrains Rider.
-
Navigate to the Git tab.
-
Click New Tag... and create a new tag.
-
Navigate to the Git panel.
-
Expand the Tags section.
-
Right-click on the newly created tag and select Push to origin.
This process will trigger the Release workflow and create a new Release on GitHub.
Alternatively, you can create and push tags using the terminal:
-
Navigate to the repository root and open the terminal.
-
Use the following command to create a new tag:
git tag 'version'Replace
versionwith the desired version, e.g.,1.0.0. -
Push the newly created tag to the remote repository using the following command:
git push origin 'version'
Note
The tag will reference your current commit, so verify you're on the correct branch and have fetched latest changes from remote first.
To create releases directly on GitHub:
-
Navigate to the Actions section on the repository page.
-
Select Publish Release workflow.
-
Click Run workflow button.
-
(Optional) Specify the release version. If not specified, the system will automatically determine the version based on your Git history.
-
Click Run.
Pushing commits to the remote repository will start a pipeline compiling the solution for all specified Revit versions. That way, you can check if the plugin is compatible with different API versions without having to spend time building it locally.
To write code compatible with different Revit versions, use the directives #if, #elif, #else, #endif.
#if REVIT2026
//Your code here
#endifTo target a specific Revit version, set the solution configuration in your IDE interface to match that version.
E.g., select the Debug.R26 configuration for the Revit 2026 API.
The project has available constants such as REVIT2026, REVIT2026_OR_GREATER.
Create conditions, experiment to achieve the desired result.
Note
For generating directives, a Revit MSBuild SDK is used. You can find more detailed documentation about it here: Revit MSBuild SDK
To support the latest APIs in legacy Revit versions:
#if REVIT2021_OR_GREATER
UnitUtils.ConvertFromInternalUnits(69, UnitTypeId.Millimeters);
#else
UnitUtils.ConvertFromInternalUnits(69, DisplayUnitType.DUT_MILLIMETERS);
#endif#if REVIT2021_OR_GREATER сompiles a block of code for Revit versions 21, 22, 23 and greater.
To support removed APIs in newer versions of Revit, you can invert the constant:
#if !REVIT2023_OR_GREATER
var builtinCategory = (BuiltInCategory) category.Id.IntegerValue;
#endif#if !REVIT2023_OR_GREATER сompiles a block of code for Revit versions 22, 21, 20 and lower.
To extend or reduce the range of supported Revit API versions, you need to update the solution and project configurations.
Solution configurations determine which projects are built and how they are configured.
To support multiple Revit versions:
- Open the
.slnfile. - Add or remove configurations for each Revit version.
Example:
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug.R24|Any CPU = Debug.R24|Any CPU
Debug.R25|Any CPU = Debug.R25|Any CPU
Debug.R26|Any CPU = Debug.R26|Any CPU
Release.R24|Any CPU = Release.R24|Any CPU
Release.R25|Any CPU = Release.R25|Any CPU
Release.R26|Any CPU = Release.R26|Any CPU
EndGlobalSection
For example Debug.R26 is the Debug configuration for Revit 2026 version.
Tip
If you are just ending maintenance for some version, removing the Solution configurations without modifying the Project configurations is enough.
Project configurations define build conditions for specific versions.
To add or remove support:
- Open
.csprojfile - Add or remove configurations for Debug and Release builds.
Example:
<PropertyGroup>
<Configurations>Debug.R24;Debug.R25;Debug.R26</Configurations>
<Configurations>$(Configurations);Release.R24;Release.R25;Release.R26</Configurations>
</PropertyGroup>Important
Edit the .csproj file only manually, IDEs often break configurations.
Revit MSBuild SDK automatically sets the required TargetFramework based on the RevitVersion, extracted from the solution configuration name.
If you need to add support for an unreleased or unsupported version of Revit that the SDK doesn't yet know about, you can add a conditional block to specify the TargetFramework manually:
<PropertyGroup>
<TargetFramework Condition="$(RevitVersion) >= '2025'">net8.0-windows7.0</TargetFramework>
</PropertyGroup>To support CI/CD pipelines and build a project for Revit versions not installed on your computer, use Nuget packages.
Note
Revit API dependencies are available in the Revit.API repository.
The Nuget package version must include wildcards Version="$(RevitVersion).*" to automatically include adding a specific package version, depending on the selected solution
configuration.
<ItemGroup>
<PackageReference Include="Nice3point.Revit.Api.RevitAPI" Version="$(RevitVersion).*"/>
<PackageReference Include="Nice3point.Revit.Api.RevitAPIUI" Version="$(RevitVersion).*"/>
</ItemGroup>- You can explore more on the RevitTemplates Wiki page.



