Nice3point.Revit.Build.Tasks 1.1.2

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package Nice3point.Revit.Build.Tasks --version 1.1.2
NuGet\Install-Package Nice3point.Revit.Build.Tasks -Version 1.1.2
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="Nice3point.Revit.Build.Tasks" Version="1.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Nice3point.Revit.Build.Tasks --version 1.1.2
#r "nuget: Nice3point.Revit.Build.Tasks, 1.1.2"
#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.
// Install Nice3point.Revit.Build.Tasks as a Cake Addin
#addin nuget:?package=Nice3point.Revit.Build.Tasks&version=1.1.2

// Install Nice3point.Revit.Build.Tasks as a Cake Tool
#tool nuget:?package=Nice3point.Revit.Build.Tasks&version=1.1.2

Revit Build Tasks

Nuget Downloads Last Commit

This repository contains the MSBuild tasks for developing and publishing the plugin for multiple Revit versions.

Installation

You can install Tasks as a nuget package.

<PackageReference Include="Nice3point.Revit.Build.Tasks" Version="1.*"/>

How to use this package? Just add it to your add-in, and this package will setup the project for simplified maintenance and development. About MSBuild targets.

Package included by default in Revit Templates.

MSBuild Targets

OR_GREATER preprocessor symbols

Included a target for generating the Define Constants needed to support code for multiple Revit versions. OR_GREATER variants are accumulative in nature and provide a simpler way to write compilation conditions.

Current configuration Project configurations Generated define constants
Debug R20 Debug R20, Release R21, Release 2022 REVIT2020, REVIT2020_OR_GREATER
Release R21 Debug R20, Release R21, Release 2022 REVIT2021, REVIT2020_OR_GREATER, REVIT2021_OR_GREATER
Release 2022 Debug R20, Release R21, Release 2022 REVIT2022, REVIT2020_OR_GREATER, REVIT2021_OR_GREATER, REVIT2022_OR_GREATER

Usage:

#if REVIT2021_OR_GREATER
    UnitUtils.ConvertFromInternalUnits(69, UnitTypeId.Millimeters);
#else
    UnitUtils.ConvertFromInternalUnits(69, DisplayUnitType.DUT_MILLIMETERS);
#endif

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

Constants are generated from the names of project configurations. If your project configurations do not contain metadata about the version, you can specify it explicitly:

<PropertyGroup>
    <RevitVersion>2025</RevitVersion>
</PropertyGroup>

To disable it, set:

<PropertyGroup>
    <DisableImplicitRevitDefines>true</DisableImplicitRevitDefines>
</PropertyGroup>

Publishing

Included a target for copying addin files to the %AppData%\Autodesk\Revit\Addins folder after building a project.

Clean solution or Clean project will delete the published files.

Copying files helps attach the debugger to the add-in when Revit starts. This makes it easier to test the application or can be used for local development.

Should only be enabled in projects containing the .addin file.

Disabled by default, to enable, set:

<PropertyGroup>
    <PublishAddinFiles>true</PublishAddinFiles>
</PropertyGroup>

By default, all project files and dependencies required for the plugin to run, including the .addin manifest, are copied. If you need to include additional files, such as configuration or family files, include them in the Content item.

The PublishDirectory property specifies which subfolder of the plugin the file should be copied to. If it is not specified, the files will be copied to the root folder.

<ItemGroup>
    <Content Include="Resources\Families\Window.rfa" PublishDirectory="Families"/>
    <Content Include="Resources\Music\Click.wav" PublishDirectory="Music\Effects"/>
    <Content Include="Resources\Images\**" PublishDirectory="Images"/>
    <Content Include="Readme.md"/>
</ItemGroup>

To disable copying Content file, set CopyToPublishDirectory="Never"

<ItemGroup>
    <Content Include="Contributing.md" CopyToPublishDirectory="Never"/>
</ItemGroup>

Result:

📂%AppData%\Autodesk\Revit\Addins\2025
 ┣📜RevitAddIn.addin
 ┗📂RevitAddIn
   ┣📂Families
   ┃ ┗📜Family.rfa
   ┣📂Images
   ┃ ┣📜Image.png
   ┃ ┣📜Image2.png
   ┃ ┗📜Image3.jpg
   ┣📂Music
   ┃ ┗📂Effects
   ┃   ┗📜Click.wav
   ┣📜CommunityToolkit.Mvvm.dll
   ┣📜RevitAddIn.dll
   ┗📜Readme.md

Implicit global usings

Included a target for generating implicit global Usings depending on the project references. Helps to reduce the frequent use of using in a project.

Global Using Enabled by reference
using Autodesk.Revit.DB; RevitAPI.dll
using JetBrains.Annotations; JetBrains.Annotations.dll
using Nice3point.Revit.Extensions; Nice3point.Revit.Extensions.dll
using Nice3point.Revit.Toolkit; Nice3point.Revit.Toolkit.dll
using CommunityToolkit.Mvvm.Input; CommunityToolkit.Mvvm.dll
using CommunityToolkit.Mvvm.ComponentModel; CommunityToolkit.Mvvm.dll

To disable it, set:

<PropertyGroup>
    <DisableImplicitRevitUsings>true</DisableImplicitRevitUsings>
    
    <ImplicitUsings>false</ImplicitUsings>
</PropertyGroup>

MSBuild Properties

By default, some properties are set that are optimal for publishing an application.

Property Default value Description
CopyLocalLockFileAssemblies true Copies NuGet package dependencies to the output directory. Required to publish an application
AppendTargetFrameworkToOutputPath false Prevents the TFM from being appended to the output path. Required to publish an application
PublishAddinFiles false Copies addin files to the %AppData%\Autodesk\Revit\Addins folder. Set true to enable copying. Handy for debugging the application instead of using AddinManager

These properties are automatically applied to the .csproj file by default and can be overriden:

<PropertyGroup>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
    <PublishAddinFiles>false</PublishAddinFiles>
</PropertyGroup>
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETFramework 4.8

    • No dependencies.
  • net8.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.1.2 731 4/13/2024
1.1.1 147 4/13/2024
1.1.0 194 4/6/2024
1.0.0 249 4/2/2024

- Update Readme
- Add extra `clean` folder