Skip to content

Need a safe way to supply a long list of assemblies to link #379

@SteveSandersonMS

Description

@SteveSandersonMS

While investigating #369, I found that the reason the linker was complaining that it couldn't find certain assemblies was because it was looking for malformed paths. Certain characters were missing from apparently random places in the middle of path strings.

The reason for this appears to be:

  1. Blazor's build config generates a command for the linker that includes -a path1\Assembly1.dll -a path2\Assembly2.dll -a path3\Assembly3.dll ..., where the list of assemblies is all those transitively reachable from the app's entrypoint assembly
  2. All those assemblies can be in totally different directories because of how NuGet works. Therefore if the linker is to find them, we have to specify their locations explictly with an -a path\AssemblyName.dll entry for each one, or alteratively specify -d path for each one, which is equally problematic.
  3. The Microsoft.CodeAnalysis.CSharp.Features assembly pulls in a long list of transitive dependencies, as do various other NuGet packages in real-world use.
  4. The total length of the generated command, then, can easily be many thousands of characters, given that each dependency's path could be 100-200 chars.
  5. MSBuild has a longstanding bug whereby extremely long commands get corrupted, removing characters from arbitrary points in the middle: Exec and (very) long commands on Windows msbuild#2530
  6. Thus the linker receives corrupted paths and fails

Proposed workaround:

  • Is there any existing way to specify the paths to a large number of transitive dependencies without including them all in the command-line command? For example, do any of the linker config file formats allow us to give path hints for transitive dependencies? Blazor already generates a linker config file as part of its build process, so we could extend this to making it list all the dependencies and their paths.
  • Or if not, would you be open to adding a further option to the linker, which is to let the user pass a file that gives the paths to all the dependencies, or perhaps just a list of directory paths in which to search for referenced assemblies?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions