Skip to content

[SDK] Pass the ILRepack arguments through a response file and run ILRepack on .NET - #217

Merged
Nice3point merged 3 commits into
mainfrom
sdk/216-repack-response-file
Oct 15, 2026
Merged

Nice3point merged 3 commits into
mainfrom
sdk/216-repack-response-file

Conversation

@Nice3point

@Nice3point Nice3point commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Summary of the Pull Request

What is this about:

Repacks an add-in on Windows with a short ILRepack command line and without the 260-character path limit.

Description:

What changed

  • RepackAddinFiles writes the output, the reference folders, and the input assemblies to ILRepack.rsp in the intermediate folder, one argument per line, and passes the file to ILRepack as @ILRepack.rsp.
  • The switches stay on the command line, and the debug and release commands differ by /noRepackRes as before.
  • ILRepack runs through the dotnet host on Windows, as it already does on Linux and macOS.
  • The changelog has a 6.3.2 entry, and the wiki states the minimum ILRepack version, 2.0.24.

Where to look

  • ILRepack reads response files since 2.0.24. The package has shipped ILRepack.runtimeconfig.json for the dotnet host since the same version. A project on an older ILRepack fails at the repack step, and the templates reference 2.0.48.
  • A response file line is one argument, and ILRepack keeps any quotes in it. The lines contain no quotes, and the trailing space that protected a /lib: folder ending in \ is gone.
  • The response file alone isn't enough under a long root. Started directly, ILRepack.exe runs on .NET Framework and throws PathTooLongException once a path exceeds 260 characters, even with long paths enabled in Windows. The dotnet host runs it on .NET, which has no such limit. Running on .NET needs a .NET 6 or later runtime, which every dotnet build has.
  • Running from the publish folder with relative paths was the alternative to the response file. It shortens the command line but keeps the reference folders, which sit outside the publish folder, at full length, and .NET Framework expands relative paths before the 260-character check.

How verified

Built a Revit 2025 release configuration (net8.0, repack enabled) of an add-in that merges 95 assemblies, from a root of 156 characters, against the SDK packed locally from this branch:

Measure 6.3.1 This branch
ILRepack command line 37,349 characters 368 characters
Result at the 156-character root MSB3073, exit code 9020 Builds
Repacked assembly Not produced 12,069,888 bytes
  • With the response file only, the same build failed with PathTooLongException: 65 of the 95 input paths exceed 260 characters.
  • The 6.3.1 build of the same commit under a 3-character root produces a repacked assembly of the same size, 12,069,888 bytes.
  • ILRepack reports the same 11 distinct warnings in both builds: missing members of merged Polyfill and JetBrains.Annotations types, a method reference warning, and a missing debug information notice.
  • Packed the SDK with dotnet pack -c Release, with no errors.
  • CI compiles the solution and runs pack test, which builds the generated templates against the SDK of this branch. Neither ran locally: pack test installs the templates into the global hive.
  • The debug configuration of the same add-in, where ILRepack merges resources, repacks at the 156-character root as well.
  • Not covered: a build from Visual Studio, where DOTNET_HOST_PATH comes from the .NET SDK resolver and dotnet on PATH is the fallback.

Open questions

  • The changelog entry is versioned 6.3.2, the next patch GitVersion computes. Change the heading if the fix ships in another release.

@Nice3point Nice3point added sdk 🔨 Nice3point.Revit.Sdk MSBuild targets bug 🐛 An unexpected issue that highlights incorrect behavior labels Oct 14, 2026
@Nice3point
Nice3point marked this pull request as ready for review October 14, 2026 21:27
Copilot AI balanced review requested due to automatic review settings October 14, 2026 21:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Nice3point
Nice3point merged commit c56aba1 into main Oct 15, 2026
2 checks passed
@Nice3point
Nice3point deleted the sdk/216-repack-response-file branch October 15, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants