views:

105

answers:

1

I have a VS solution (.sln) that has the following structure.

  • Project A
  • Project B (contains reference to Project A as well as references to 3rd party assemblies like NHibernate, StructureMap, etc)

I want to use ILMerge to roll the 3rd party assemblies into the ProjectB.dll. However, I don't want to merge ProjectA.

I've used the procedure highlighted here. This has worked seamlessly for me regarding the merging of the third party assemblies. However, I'm still getting this error when building ProjectB:

An exception occurred during merging: Unresolved assembly reference not allowed: ProjectA.

I'm not explicitly specifying that ProjectA be merged. In other words, I don't say true for this project. How do I get IlMerge to ignore ProjectA? By the way, ProjectA is a project reference, not a direct assembly reference.

Thanks!

A: 

Use the /lib argument for ILMerge, passing the directory containing ProjectA.dll.

Specifically (assuming ProjectB's target platform is the .NET 4.0 client profile):

ILMerge.exe /out:MasterDll.dll
            /targetplatform:v4,"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client"
            /lib:ProjectA\bin\Release
            ProjectB\bin\Release\ProjectB.dll
            Libraries\NHibernate\NHibernate.dll
            Libraries\StructureMap\StructureMap.dll
            ...
Stephen Cleary