ILMerge错误Windows Phone 8未解析的程序集引用

时间:2013-03-16 22:58:30

标签: windows-phone-8 ilmerge

我正在尝试使用ILMerge.exe(2.12.0803)合并Windows Phone 8的一些.net程序集。在他们自己的所有组件工作正常。我可以成功合并不包含对Windows.Networking命名空间的引用的汇编,如下所示:

  

。\ ILMerge.exe / lib:“%ProgramFiles(x86)%\ Reference   大会\微软\框架\ WindowsPhone的\ V8.0"   /out:.\WP8\%1\MathToolbox.dll。\%1 \ MathBase.dll。\%1 \ PolyFunctions.dll

一旦我尝试包含一个使用Windows.Networking namspace的DLL,如下所示:

  

。\ ILMerge.exe / lib:“%ProgramFiles(x86)%\ Reference   大会\微软\框架\ WindowsPhone的\ V8.0"   /out:.\WP8\%1\MathToolbox.dll。\%1 \ MathBase.dll。\%1 \ PolyFunctions.dll   \%1 \ RemoteTools.dll

我收到以下异常:

  

合并期间发生异常:未解析的程序集引用   不允许:Windows。在   System.Compiler.Ir2md.GetAssemblyRefIndex(AssemblyNode程序集)at   System.Compiler.Ir2md.GetTypeRefIndex(TypeNode类型)at   System.Compiler.Ir2md.VisitReferencedType(TypeNode类型)at   System.Compiler.Ir2md.VisitClass(Class Class)at   System.Compiler.Ir2md.VisitModule(模块模块)at   System.Compiler.Ir2md.SetupMetadataWriter(String debugSymbolsLocation)   在System.Compiler.Ir2md.WritePE(Module module,String   debugSymbolsLocation,BinaryWriter writer)at   System.Compiler.Writer.WritePE(String location,Boolean   writeDebugSymbols,Module module,Boolean delayS ign,String   keyFileName,String keyName)at   System.Compiler.Writer.WritePE(CompilerParameters compilerParameters,   模块模块)在ILMerging.ILMerge.Merge()处   ILMerging.ILMerge.Main(String [] args)

完成了一些阅读此异常后,ILMerge无法找到Windows.Networking程序集。我试图向ILMERGE添加各种不同的标志,包括:

  

。\ ILMerge.exe / lib:“%ProgramFiles(x86)%\ Reference   Assemblies \ Microsoft \ Framework \ WindowsPhone \ v8.0“/ targetplatform:v4,”%ProgramFiles(x86)%\ Reference Assemblies \ Microsoft \ Framework \ Silverlight \ v4.0 \ Profile \ WindowsPhone71“   /out:.\WP8\%1\MathToolbox.dll。\%1 \ MathBase.dll。\%1 \ PolyFunctions.dll   \%1 \ RemoteTools.dll

但仍然得到同样的例外。如果有人有任何建议,将不胜感激。

2 个答案:

答案 0 :(得分:2)

我认为ILMerge实际上并不适用于纯.NET程序集,特别是当Windows Phone 8和WinRT项目使用引用的本机库时 - 可能是找不到“Windows”未解析的程序集。

答案 1 :(得分:2)

错误表明ILMerge无法找到平台的Windows.winmd。编译Windows Phone或Windows应用商店项目时,可以针对两个主要内容进行编译。 Platform SDK(WinRT)和.NET SDK。任何在这些程序集上运行的工具都需要这两个工具。

除了传递.NET程序集文件夹外,尝试将“C:\ Program Files(x86)\ Windows Phone Kits \ 8.0 \ Windows Metadata目录”作为lib参数传递。

请注意,ILMerge基于较旧版本的CCI(http://ccimetadata.codeplex.com/),因此即使在执行上述操作后,仍然可能无法使用与.NET略有不同的WinRT元数据格式。