Cookies

This website uses cookies to obtain statistics from users navigation. If you go on browsing we consider you accept them.

Ilmerge. The target assembly lists itself as an external reference

I’ve made my mind to do this post just because I saw there wasn’t a solution to what happened to me with this problem, even though the solution to it was pretty naive to me. The thing is, in an ASP.NET project, I have a publish profile with precompilation enabled and with the advanced precompile option “Merge all outputs to a single assembly” enabled too. I decided to set to this output assembly my project name, something that seemed to me the right thing to do. But then, suddenly a misterious error showed up.

Publish Profile

An error occurred when merging assemblies: ILMerge.Merge: The target assembly ‘Whatever’ lists itself as an external reference

ILMerge error

I didn’t have a reference to the same project anywhere, what was this error about? After googling for a while, I decided to do the silliest attempt to solve the issue, that kind of change you don’t think is going to fix it, but, why not trying? I changed the output assembly name. And the error vanished. And everything worked. So I had wasted a morning because of something so simple…

I hope this post now prevents you from losing yours. Please try it out, because in my case it worked!