Skip to content

Third party files

Nice3point edited this page Apr 6, 2024 · 15 revisions

RevitTemplates includes the Revit.Build.Tasks package. It allows you to quickly and easily publish your add-in to the %AppData%\Autodesk\Revit\Addins folder, from where Revit will automatically load the add-in on startup. The same is required to create an MSI installer.

By default, the .dll and .addin files are copied to the publish folder. If you need to include additional files, such as configurations or family files, include them in the Content item.

Tagging third-party files

All extra files that will be copied to the Revit Add-ins folder and also added to the installer must be tagged. First you need to change the build action for the file from None to Content

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

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 add-in folder.

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

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

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

Remember to use wildcards when adding files with similar names:

<ItemGroup>
    <Content Include="Resources\Families\*"/>
    <Content Include="Resources\Music\*.wav"/>
    <Content Include="Resources\**\*"/>
    <Content Include="Resources\**\*.png"/>
</ItemGroup>
  • Resources\Families\* - all files in the Families folder inside the Resources folder.
  • Resources\Music\*.wav - all files with the extension .wav in the Music folder, which is located in the Resources folder.
  • Resources\**\** - all files in the Resources folder and all its subfolders.
  • Resources\**\*\*.png - all files with extension .png in the Resources folder and all its subfolders.

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

Publishing files disabled by default. To enable it, set <PublishAddinFiles>true</PublishAddinFiles>. Should only be enabled in projects containing the .addin file.