ActionJackson
ActionJackson

Reputation: 11

ILMerge and Project References

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

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!

Upvotes: 1

Views: 4789

Answers (2)

chuck
chuck

Reputation: 1

For 4.0 just use:

/targetplatform:v4,"%ProgramFiles%\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0"

Upvotes: -1

Stephen Cleary
Stephen Cleary

Reputation: 457462

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
            ...

Upvotes: 6

Related Questions