Skip to content

Repacking fails on Windows when the ILRepack command line exceeds the length limit #216

Closed

Description

@Nice3point

Repacking an add-in succeeds on Windows whatever the number of merged assemblies and the length of the project path.

The SDK passes every input assembly and every reference folder to ILRepack as a full path on the command line.
Windows rejects a command line longer than 32,767 characters, and a Revit add-in that merges about 90 assemblies reaches that limit under a long directory.

Steps to reproduce

  1. Take an add-in with IsRepackable enabled whose publish folder contains about 90 assemblies.
  2. Place the solution under a directory whose path is about 150 characters long.
  3. Build a release configuration with publishing enabled, for example dotnet build -c Release.R25.

Expected behavior

  • The build merges the assemblies into the add-in assembly at any path length.

Actual behavior

  • The build fails in RepackAddinFiles:

    Nice3point.Revit.Repack.targets(66,9): error MSB3073: The command ""…\ilrepack\2.0.48\tools\ILRepack.exe" /union /illink /parallel /noRepackRes /out:… /lib:… …" exited with code 9020.
    
  • Exit code 9020 means "The system cannot execute the specified program".

  • The command line of the failing build has 37,349 characters, and repeats the root path 113 times.

  • The same add-in under a 45-character root produces about 25,300 characters, close to the limit already.

  • With a shorter command line, the same build fails inside ILRepack with System.IO.PathTooLongException. On Windows, ILRepack.exe runs on .NET Framework, which rejects a path longer than 260 characters, and 65 of the 95 input paths exceed it.

Environment

  • Nice3point.Revit.Sdk 6.3.1
  • ILRepack 2.0.48
  • Windows 11, .NET SDK 10.0.112, Revit 2025 configuration (net8.0-windows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug 🐛An unexpected issue that highlights incorrect behaviorsdk 🔨Nice3point.Revit.Sdk MSBuild targets

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions