I am creating a custom package using a nuspec where i specify a dependency. I am also merging several dlls into one dll.
I need to reference an external dll so that the merged dll doesn't include the external dlls.
I executed the following command:
ILMerge.exe /out:C:\Temp\lib\netstandard2.0\ProjectA.dll "ProjectC.dll" "ProjectD.dll"
ProjectC.dll depends on a external package called ProjectZ.dll, i need to add ProjectZ.dll as a external dependency and not include in the ProjectA.dll.
Running the command without ProjectZ.dll in the arguments i get the error:
An exception occurred during merging:
Unresolved assembly reference not allowed: ProjectZ.
at System.Compiler.Ir2md.GetAssemblyRefIndex(AssemblyNode assembly)
at System.Compiler.Ir2md.GetTypeRefIndex(TypeNode type)
at System.Compiler.Ir2md.GetTypeDefOrRefOrSpecEncoded(TypeNode type)
at System.Compiler.Ir2md.VisitInterface(Interface Interface)
at System.Compiler.Ir2md.Visit(Node node)
at System.Compiler.Ir2md.VisitModule(Module module)
at System.Compiler.Ir2md.SetupMetadataWriter(String debugSymbolsLocation)
at System.Compiler.Ir2md.WritePE(Module module, String debugSymbolsLocation, BinaryWriter writer)
at System.Compiler.Writer.WritePE(String location, Boolean writeDebugSymbols, Module module, Boolean delaySign, String keyFileName, String keyName)
at System.Compiler.Writer.WritePE(CompilerParameters compilerParameters, Module module)
at System.Compiler.Module.WriteModule(String location, CompilerParameters options)
at ILMerging.ILMerge.Merge()
at ILMerging.ILMerge.Main(String[] args)
Example Moq.dll has a referenced assembly for Castle.Core: