Skip to content

Key needs to be greater than 0 - possible error when running task multiple times #27

Description

@mpseidel

This error in ILMerge can occur when using the build task multiple times in the same build.

In our case we had about 10 projects in a solution that needed to be merged individually. As the build task loads the ILMerge assembly once into the build process and ILMerge uses statics this can lead to the error Key needs to be greater than 0 explained in more detail in the referenced issue.

Our workarround was to turn on BuildInParallel and setting -maxcpucount > 1 which reduced the number of merge operations per msbuild process.

As

it [ILmerge] was definitely written as a console application that would run once and then terminate.

I would suggest a) allow the option to spawn a new ILMerge process per merge operation or b) load ILMerge into a secondary AppDomain and unload it after the merge or c) maybe consider a upstream fix if possible.

This issue has caused us quite some pain as builds were failing seemingly randomly so I hope someone else finds this and can save themselves some headache.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions