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
                    
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="MoGo.Revit.Extensions" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MoGo.Revit.Extensions" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="MoGo.Revit.Extensions" />
                    
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 MoGo.Revit.Extensions --version 1.0.1
                    
#r "nuget: MoGo.Revit.Extensions, 1.0.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 MoGo.Revit.Extensions@1.0.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=MoGo.Revit.Extensions&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=MoGo.Revit.Extensions&version=1.0.1
                    
Install as a Cake Tool

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:

  1. Your RevitVersion property matches your target Revit version
  2. Your TargetFramework is correct:
    • Revit 2023/2024 → net481
    • Revit 2025/2026 → net8.0-windows

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:

  1. Navigate to the MoGo.Revit.Extensions folder
  2. 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:\LocalNuGet for 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:

  1. Copy to your local NuGet source (e.g., C:\LocalNuGet)
  2. Clear NuGet cache:
    dotnet nuget locals all --clear
    
  3. Add the local source to your project:
    dotnet nuget add source C:\LocalNuGet
    
  4. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .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