ILMerge strange behaviour

2019-06-04 18:31发布

问题:

I have an issue using the latest version of ILMerge and I would like if someone can explain me if this is normal. During my search on the web I realized I was not using the latest version of ILMerge so I updated my projects and this is where everything got wrong… First let me explain quickly my project dependencies:

  • The dll project A references and uses ILMerge.
  • The dll project B references and uses the dll A but it do not reference ILMerge.
  • The application project C reference the dll B but it do not reference A nor ILMerge.

My issue is : with the latest version of ILMerge the file is not copied in the output bin folder when the projects B or C are compiled.

With the ILMerge version 2.11.502.0:

  • When I build the dll project A the bin folder contains A.dll and ILMerge.exe.
  • When I build the dll project B the bin folder contains B.dll, A.dll and ILMerge.exe.
  • When I build the dll project C the bin folder contains C.dll, B.dll, A.dll and ILMerge.exe.

However, with the ILMerge version 2.14.1208:

  • When I build the dll project A the bin folder contains A.dll and ILMerge.exe.
  • When I build the dll project B the bin folder contains B.dll and A.dll.
  • When I build the dll project C the bin folder contains C.dll, B.dll and A.dll.

When I made the move to use the latest version of ILMerge I updated the reference in my project A and make sure to set the property Copy Local to true. When I revert back to the older version it works as expected and the file is copied everywhere.

I am using Visual Studio 2012. I have been told by Mike Barnett from Microsoft that this weird behavior exists also with VS2013 but not with VS2015.

Did someone ever encounter a similar issue?

Here is an example: ILMergeIssue.zip