我有一个构建脚本,可以将5个项目构建并合并到一个dll中。其中一个项目引用了System.Web.Mvc DLL,它驻留在我的Dependencies文件夹中。我将此文件从ASP.NET MVC3文件夹复制到我的项目文件夹中。
运行ILMerge后出现错误。
Merging Primary Assembly
An exception occurred during merging:
Unresolved assembly reference not allowed: System.Web.Mvc.
at System.Compiler.Ir2md.GetAssemblyRefIndex(AssemblyNode assembly)
at System.Compiler.Ir2md.GetTypeRefIndex(TypeNode type)
at System.Compiler.Ir2md.WriteTypeDefOrRefEncoded(BinaryWriter target, TypeNode type)
at System.Compiler.Ir2md.WriteTypeSignature(BinaryWriter target, TypeNode type, Boolean instantiateGenericTypes)
at System.Compiler.Ir2md.WriteTypeSignature(BinaryWriter target, TypeNode type, Boolean instantiateGenericTypes)
at System.Compiler.Ir2md.GetBlobIndex(TypeNode type)
at System.Compiler.Ir2md.GetTypeSpecIndex(TypeNode type)
at System.Compiler.Ir2md.VisitReferencedType(TypeNode type)
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, Boolean delaySign, String keyFileName, String keyName)
at System.Compiler.Writer.WritePE(CompilerParameters compilerParameters, Module module)
at ILMerging.ILMerge.Merge()
at ILMerging.ILMerge.Main(String[] args)
Rereferencing Merged Assembly
为什么我会得到这个?
答案 0 :(得分:1)
或者您可以在脚本中使用ILMarge / lib选项,如:
ILMerge.exe /lib:C:\Windows\Microsoft.NET\Framework64\v4.0.30319 / lib:“c:\ Program Files(x86)\ Microsoft ASP.NET \ ASP.NET MVC 3 \ Assemblies“