Referencing assemblies created with ILMerge in Visual Studio projects

Posted by Daniel Schaffer on Stack Overflow See other posts from Stack Overflow or by Daniel Schaffer
Published on 2010-05-06T03:19:29Z Indexed on 2010/05/06 3:38 UTC
Read the original article Hit count: 432

Filed under:
|

I have a solution in Visual Studio with 5 projects. They are:

  • Foo.Core: Core functionality
  • Foo.Api: Generated code built on top of core
  • Foo.Web: Web-specific extensions
  • Foo.Web.Mvc: MVC-specific extensions
  • Newtonsoft.Json: 3rd party library

I want to use ILMerge to merge Foo.Core, Foo.Api and Newtonsoft.Json into a single assembly, called Foo. That's the easy part.

The problem I'm running into is that Foo.Web and Foo.Web.Mvc both need to reference all three of the merged assemblies.

If I reference the original assemblies, they will have invalid references after I do the ILMerge.

If I reference the ILMerged assembly, I have to reference a debug assembly and then change it before I package everything up, which doesn't seem ideal.

I've tried creating a project called Foo, which references the 3 merged assemblies and replaces its own output with the ILmerged assembly, but that doesn't seem to work at all.

Is there a reliable way to do this?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about ilmerge