Link to assemblies created using ILMerge in Visual Studio projects

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

  • Foo.Core: basic functionality
  • Foo.Api: Generated code built on top of the kernel
  • Foo.Web: website extensions
  • Foo.Web.Mvc: MVC dependent extensions
  • Newtonsoft.Json: third-party library

I want to use ILMerge to merge Foo.Core, Foo.Apiand Newtonsoft.Jsoninto one assembly called Foo. This is the easy part.

The problem that I encounter is that Foo.Web, and Foo.Web.Mvcboth should refer to all three combined assembly.

If I reference the source assemblies, they will have invalid references after ILMerge is executed.

If I reference the assembly with ILMerged, I must reference the debug assembly and then modify it before packing everything that doesn't seem ideal.

I tried to create a project called Foothat references 3 merged assemblies and replaces its own result with ILmerged assembly, but this does not seem to work at all.

Is there a reliable way to do this?

+5
source share
2 answers

I know that I am late for the game very late, but we struggled with the same problem, and this is how we solved it.

csproj , , . . script, :

  • .
  • ILMerge , .
  • , , , .
+3

ILMerge / "" (API, ...) , , gac, " " , .

: PostBuildEvent / (Foo.Api?), PreBuildEvent Foo.Web Foo.Web.Mvc Foo, Foo.Web Foo.Web.Mvc .

Visual Studio, MsBuild. A ( fooobar.com/questions/90971/...).

+2

All Articles