Running Win 7 and Visual Studio Express 2013 for Desktop. If you are getting error messages like this:
An exception occurred during merging:
Unresolved assembly reference not allowed: System.Core.
at System.Compiler.Ir2md.GetAssemblyRefIndex(AssemblyNode assembly)
at System.Compiler.Ir2md.GetTypeRefIndex(TypeNode type)
at System.Compiler.Ir2md.VisitReferencedType(TypeNode type)
at System.Compiler.Ir2md.GetMemberRefIndex(Member m)
at System.Compiler.Ir2md.GetMethodToken(Method m)
at System.Compiler.Ir2md.VisitMethodCall(MethodCall call)
at System.Compiler.Ir2md.VisitBranch(Branch branch)
at System.Compiler.Ir2md.VisitBlock(Block block)
at System.Compiler.Ir2md.VisitBlock(Block block)
at System.Compiler.Ir2md.VisitMethodBody(Method method)
at System.Compiler.Ir2md.VisitMethod(Method method)
at System.Compiler.Ir2md.VisitClass(Class Class)
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)
at System.Compiler.Writer.WritePE(CompilerParameters compilerParameters, Module module)
at ILMerging.ILMerge.Merge()
at ILMerging.ILMerge.Main(String[] args)
There is an easy solution. You simply need to add /targetplatform:v4,[dotnet-path]
parameter to your ILMerge build command. For me the framework path is:
C:\Windows\Microsoft.NET\Framework\v4.0.30319
Tyhe full merge command should look something like this:
ilmerge /targetplatform:v4,"C:\Windows\Microsoft.NET\Framework\v4.0.30319" /out:"c.exe" "a.exe" "b.dll"
This should resolve the issue.
This got me most of the way there, but I had to quote the whole
/targetplatform
section for it to work in my case, not really to sure why though: