dotnet / ILMerge

ILMerge is a static linker for .NET Assemblies.
MIT License
1.23k stars 170 forks source link

ILMerge and Unit Tests #100

Open kaluznyt opened 3 years ago

kaluznyt commented 3 years ago

Hello,

I'm having a problem which I'm not able to solve yet, I have an app that has 2 Projects: General Helper

Both are setup with ILMerge, basically the idea is that everything should be merged into General.dll - and that works fine.

Just as a side note - this is use case for Dynamics CRM Plugins.

Now, there is a need to add a Test project.

The test project tests classes in both Helper and General. However, when referencing both, there is an error on build:

error CS0433: The type 'SomeType' exists in both 'General' and 'Helper'

Originally this SomeType class is in Helper.

And the error is understandable, since the General is merged dll so it has the Helper types bundled. The issue is I'm not able to use those types in Test project by just referencing General, so I need to add Helper as a reference as well.

How to approach this ?

I got an idea that I could create multiple test projects one for each of the tested projects, and that most probably should work, because there is no issue when there is only 1 dependency in test project.

Tried to tweak some settings in the ILMerge.props but without success.

Thanks for any hints !