MoGo.Revit.Extensions
1.0.1
dotnet add package MoGo.Revit.Extensions --version 1.0.1
NuGet\Install-Package MoGo.Revit.Extensions -Version 1.0.1
<PackageReference Include="MoGo.Revit.Extensions" Version="1.0.1" />
<PackageVersion Include="MoGo.Revit.Extensions" Version="1.0.1" />
<PackageReference Include="MoGo.Revit.Extensions" />
paket add MoGo.Revit.Extensions --version 1.0.1
#r "nuget: MoGo.Revit.Extensions, 1.0.1"
#:package MoGo.Revit.Extensions@1.0.1
#addin nuget:?package=MoGo.Revit.Extensions&version=1.0.1
#tool nuget:?package=MoGo.Revit.Extensions&version=1.0.1
MoGo.Revit.Extensions
Extension methods and utilities for Revit API development. Supports Revit 2023, 2024, 2025, and 2026.
Installation
Install via NuGet Package Manager:
Install-Package MoGo.Revit.Extensions
Or via .NET CLI:
dotnet add package MoGo.Revit.Extensions
⚠️ IMPORTANT: Required Configuration
You MUST add the RevitVersion property to your .csproj file for the package to work correctly.
The package contains DLLs for all Revit versions (2023-2026), but it needs to know which version to use in your project.
Configuration Examples
For Revit 2023:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net481</TargetFramework>
<RevitVersion>2023</RevitVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MoGo.Revit.Extensions" Version="1.0.0" />
</ItemGroup>
</Project>
For Revit 2024:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net481</TargetFramework>
<RevitVersion>2024</RevitVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MoGo.Revit.Extensions" Version="1.0.0" />
</ItemGroup>
</Project>
For Revit 2025:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<RevitVersion>2025</RevitVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MoGo.Revit.Extensions" Version="1.0.0" />
</ItemGroup>
</Project>
For Revit 2026:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<RevitVersion>2026</RevitVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MoGo.Revit.Extensions" Version="1.0.0" />
</ItemGroup>
</Project>
Supported Revit Versions
| Revit Version | Target Framework | RevitVersion Property |
|---|---|---|
| 2023 | net481 | 2023 |
| 2024 | net481 | 2024 |
| 2025 | net8.0-windows | 2025 |
| 2026 | net8.0-windows | 2026 |
How It Works
When you build your project, you'll see a message like:
MoGo.Revit.Extensions: Using Revit 2025 version for net8.0-windows
This confirms that the correct DLL version is being used.
Features
MoGo.Revit.Extensions provides helpful extension methods for:
- Application Extensions: UIApplication, Document, and Application helpers
- Element Extensions: Category, geometry, location, parameters, and general element operations
- Geometry Extensions: BoundingBox operations and geometry visualization
- Material Extensions: Material property manipulation
- Layer Extensions: CompoundStructure and layer operations
- Link Extensions: Revit link document handling
- Workset Extensions: Workset and ownership management
Usage Example
using Autodesk.Revit.DB;
using MoGo.Revit.Extensions.ElementExtensions;
// Example: Get element's Revit ElementId as long
ElementId elementId = element.Id;
long id = elementId.GetRevitElementId();
// Example: Check element category
if (element.IsWall())
{
// Do something with wall
}
// Many more extension methods available!
Troubleshooting
Error: "MoGo.Revit.Extensions.dll could not be found"
Solution: Make sure you've added the <RevitVersion> property to your .csproj file.
Wrong DLL version loaded
Solution: Verify that:
- Your
RevitVersionproperty matches your target Revit version - Your
TargetFrameworkis correct:- Revit 2023/2024 →
net481 - Revit 2025/2026 →
net8.0-windows
- Revit 2023/2024 →
Build warnings about framework mismatch
Example Warning:
Revit 2025 requires TargetFramework net8.0-windows, but your project is targeting net481
Solution: Update your TargetFramework to match the required framework for your Revit version.
Development
Building and Packaging
To create a NuGet package with all 4 Revit versions:
- Navigate to the
MoGo.Revit.Extensionsfolder - Run the CreatePackage.bat script with your desired version:
CreatePackage.bat 1.0.2
This script will:
- Build all 4 Revit configurations (2023, 2024, 2025, 2026)
- Download nuget.exe if not present
- Create a NuGet package in
bin\NuGet\folder - Optionally copy the package to
C:\LocalNuGetfor local testing
Package contents:
- All 4 DLLs for Revit 2023-2026
- MSBuild .props file for automatic version selection
- README documentation
Testing Locally
After creating the package:
- Copy to your local NuGet source (e.g.,
C:\LocalNuGet) - Clear NuGet cache:
dotnet nuget locals all --clear - Add the local source to your project:
dotnet nuget add source C:\LocalNuGet - Install the package in your test project and verify the correct DLL is selected
License
MIT License
Support
For issues, questions, or contributions, please visit the GitHub repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows is compatible. net9.0-windows was computed. net10.0-windows was computed. |
| .NET Framework | net481 is compatible. |
-
.NETFramework 4.8.1
- No dependencies.
-
net8.0-windows7.0
- No dependencies.
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 |
|---|---|---|
| 1.0.1 | 167 | 1/2/2026 |
Initial release with support for Revit 2023-2026