Autodesk.PackageBuilder 2.0.0

dotnet add package Autodesk.PackageBuilder --version 2.0.0
                    
NuGet\Install-Package Autodesk.PackageBuilder -Version 2.0.0
                    
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="Autodesk.PackageBuilder" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Autodesk.PackageBuilder" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Autodesk.PackageBuilder" />
                    
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 Autodesk.PackageBuilder --version 2.0.0
                    
#r "nuget: Autodesk.PackageBuilder, 2.0.0"
                    
#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.
#addin nuget:?package=Autodesk.PackageBuilder&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Autodesk.PackageBuilder&version=2.0.0
                    
Install as a Cake Tool

Autodesk.PackageBuilder

Autodesk AutoCAD Revit 3ds Max Inventor Maya Navisworks

Visual Studio 2022 Nuke License MIT Build Release

This package is intended to build Autodesk PackageContent.xml and RevitAddin.addin/InventorAddin.addin using C# fluent API.

Autodesk Product Version Table

Product RuntimeRequirements::SeriesMin/SeriesMax RuntimeRequirements::Platform
AutoCAD R24.0 (2021), R23.1 (2020), R23.0 (2019) AutoCAD*
Revit R2021, R2020, R2019, R2018, R2017 Revit
Maya 2021, 2020, 2019, 2018, ... Maya
3ds Max 2021, 2020, 2019, 2018, ... 3ds Max|3ds Max Design
Inventor (version is taken from add-in manifest) Inventor
Navisworks Nw18 (2021), Nw17 (2020), Nw16 (2019) NAVMAN|NAVSIM
Vault V2021, V2020, V2019, ... Vault
Fusion 360 (No version, leave empty) Fusion 360

Examples

Create PackageContents.xml

To get the PackageContents.xml like this:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationPackage SchemaVersion="1.0" ProductType="Application" AutodeskProduct="Revit" Name="RevitAddin" AppVersion="1.0.0">
  <CompanyDetails Name="Company Name" Email="email" Url="url" />
  <Components Description="Revit 2021">
    <RuntimeRequirements OS="Win64" Platform="Revit" SeriesMin="R2021" SeriesMax="R2021" />
    <ComponentEntry AppName="RevitAddin" ModuleName="./Contents/2021/RevitAddin.addin" />
  </Components>
  <Components Description="Revit 2022">
    <RuntimeRequirements OS="Win64" Platform="Revit" SeriesMin="R2022" SeriesMax="R2022" />
    <ComponentEntry AppName="RevitAddin" ModuleName="./Contents/2022/RevitAddin.addin" />
  </Components>
</ApplicationPackage>

Inherit your builder class from PackageContentsBuilder base class.

public class DemoPackageBuilder : PackageContentsBuilder
{
    public DemoPackageBuilder()
    {
        ApplicationPackage
            .Create()
            .ProductType(ProductTypes.Application)
            .AutodeskProduct(AutodeskProducts.Revit)
            .Name("RevitAddin")
            .AppVersion("1.0.0");

        CompanyDetails
            .Create("Company Name")
            .Email("email")
            .Url("url");

        Components
            .CreateEntry("Revit 2021")
            .OS("Win64")
            .Platform("Revit")
            .SeriesMin("R2021")
            .SeriesMax("R2021")
            .AppName("RevitAddin")
            .ModuleName(@"./Contents/2021/RevitAddin.addin");

        Components
            .CreateEntry("Revit 2022")
            .RevitPlatform(2022)
            .AppName("RevitAddin")
            .ModuleName(@"./Contents/2022/RevitAddin.addin");
    }
}

Or use BuilderUtils.Build<PackageContentsBuilder>().

var builder = BuilderUtils.Build<PackageContentsBuilder>(builder =>
{
    builder.ApplicationPackage
        .Create()
        .ProductType(ProductTypes.Application)
        .AutodeskProduct(AutodeskProducts.Revit)
        .Name("RevitAddin")
        .AppVersion("1.0.0");

    builder.CompanyDetails
        .Create("Company Name")
        .Email("email")
        .Url("url");

    builder.Components
        .CreateEntry("Revit 2021")
        .OS("Win64")
        .Platform("Revit")
        .SeriesMin("R2021")
        .SeriesMax("R2021")
        .AppName("RevitAddin")
        .ModuleName(@"./Contents/2021/RevitAddin.addin");

    builder.Components
        .CreateEntry("Revit 2022")
        .RevitPlatform(2022)
        .AppName("RevitAddin")
        .ModuleName(@"./Contents/2022/RevitAddin.addin");
});

Getting results

String result

var builder = new DemoPackageBuilder();
var result = builder.ToString();

.xml file

var builder = new DemoPackageBuilder();
builder.Build("PackageContents.xml");

// or

BuilderUtils.Build<DemoPackageBuilder>("PackageContents.xml");

// or

BuilderUtils.Build<DemoPackageBuilder>("PackageContents.xml", builder => {...});

// or

BuilderUtils.Build<DemoPackageBuilder>(builder => {...}, "PackageContents.xml");

// or

BuilderUtils.Build<DemoPackageBuilder>(builder => {...}).Build("PackageContents.xml");

Create RevitAddin.addin

To get the RevitAddin.addin like this:

<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
  <AddIn Type="Application">
    <Name>RevitAddin</Name>
    <AddInId>11111111-2222-3333-4444-555555555555</AddInId>
    <Assembly>RevitAddin.dll</Assembly>
    <FullClassName>RevitAddin.App</FullClassName>
    <VendorId>RevitAddin</VendorId>
    <VendorDescription>RevitAddin</VendorDescription>
  </AddIn>
</RevitAddIns>

Inherit your builder class from RevitAddInsBuilder base class.

public class DemoAddinBuilder : RevitAddInsBuilder
{
    public DemoAddinBuilder()
    {
        AddIn.CreateEntry("Application")
            .Name("RevitAddin")
            .AddInId("11111111-2222-3333-4444-555555555555")
            .Assembly("RevitAddin.dll")
            .FullClassName("RevitAddin.App")
            .VendorId("RevitAddin")
            .VendorDescription("RevitAddin");
    }
}

Or use BuilderUtils.Build<RevitAddInsBuilder>().

var builder = BuilderUtils.Build<RevitAddInsBuilder>(builder =>
{
    builder.AddIn.CreateEntry("Application")
        .Name("RevitAddin")
        .AddInId("11111111-2222-3333-4444-555555555555")
        .Assembly("RevitAddin.dll")
        .FullClassName("RevitAddin.App")
        .VendorId("RevitAddin")
        .VendorDescription("RevitAddin");
});

Getting results

String result

var builder = new DemoAddinBuilder();
var result = builder.ToString();

.addin file

var builder = new DemoAddinBuilder();
builder.Build("RevitAddin.addin");

// or

BuilderUtils.Build<DemoAddinBuilder>("RevitAddin.addin");

// or

BuilderUtils.Build<DemoAddinBuilder>("RevitAddin.addin", builder => {...});

// or

BuilderUtils.Build<DemoAddinBuilder>(builder => {...}, "RevitAddin.addin");

// or

BuilderUtils.Build<DemoAddinBuilder>(builder => {...}).Build("RevitAddin.addin");

Not implemented Attribute and Element

If the Attribute or Element is not implemented, you can use DataBuilder to access the methods CreateAttribute and CreateElement.

var builder = BuilderUtils.Build<PackageContentsBuilder>(builder =>
{
    builder.Components
        .CreateEntry("Revit 2021")
        .DataBuilder.CreateAttribute("Attribute", "Value");

    builder.Components
        .CreateEntry("Revit 2022")
        .DataBuilder.CreateElement("Element", "Value");

    builder.Components
        .CreateEntry("Revit 2023")
        .DataBuilder.CreateAttribute<ComponentEntry>("Attribute", "Value");

    builder.Components
        .CreateEntry("Revit 2024")
        .DataBuilder.CreateElement<ComponentEntry>("Element", "Value");
});
Create custom Element/Attribute

The class ExtensibleData could be used to create custom Element.

public class CustomElement : ExtensibleData
{
    [XmlAttribute]
    public string Name { get; set; }
    [XmlElement]
    public string Value { get; set; }
}

The ExtensibleData uses a XmlSerializer to serialize the object. Use the DataBuilder to access the methods CreateElement and CreateAttribute to create custom elements or attributes.

var builder = BuilderUtils.Build<PackageContentsBuilder>(builder =>
{
    var custom = new CustomElement()
    {
        Name = "Name",
        Value = "Value"
    };

    var componentRevit2021 = builder.Components
        .CreateEntry("Revit 2021");

    componentRevit2021.DataBuilder.CreateAttribute("Attribute", true);
    componentRevit2021.DataBuilder.CreateElement("Element", true);
    componentRevit2021.DataBuilder.CreateElement("CustomElement", custom);
});

This is the result of the above code:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationPackage>
    <CompanyDetails />
    <Components Description="Revit 2021" Attribute="True">
    <Element>true</Element>
    <CustomElement Name="Name">
        <Value>Value</Value>
    </CustomElement>
    </Components>
</ApplicationPackage>

Package Inspiration / Reference

This package was inspired by InnoSetup.ScriptBuilder package.

License

This package is licensed under the MIT License.


Do you like this package? Please star this project on GitHub!

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Autodesk.PackageBuilder:

Package Downloads
ricaun.Nuke.PackageBuilder

Nuke PackageBuilder for Autodesk Application.

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Autodesk.PackageBuilder:

Repository Stars
lookup-foundation/RevitLookup
Interactive Revit RFA and RVT project database exploration tool to view and navigate BIM element parameters, properties and relationships.
Nice3point/RevitTemplates
Templates for creating Revit add-ins
Version Downloads Last Updated
2.0.0 324 6/11/2025
1.0.6 8,696 12/6/2023
1.0.5 8,988 2/17/2022
1.0.4 2,551 12/9/2021
1.0.3 457 12/7/2021
1.0.2 533 12/3/2021