我在具有管理员权限的cmd上使用以下命令:
ILMerge.exe /wildcards /log:ILMerge.log /allowdup
/targetplatform:"v4,C:\Windows\Microsoft.NET\Framework\v4.0.30319"
/lib:"C:\SDK2016\SDK2016\Bin"
/lib:"packages\Microsoft.CrmSdk.Extensions.7.1.0.1\lib\net45"
/lib:"packages\log4net.2.0.5\lib\net45-full"
/keyfile:"Tools\Snk\XXX.snk"
/out:"c:\XXXALLMERGED.dll"
"c:\proj\alldlls\*.dll"
Run Code Online (Sandbox Code Playgroud)
我在日志文件的末尾收到以下错误:
An exception occurred during merging:
Unable to load DLL 'mscorsn.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at System.Compiler.Writer.MscorsnStrongNameSignatureGeneration(String wszFilePath, String wszKeyContainer, Byte[] pbKeyBlob, Int32 cbKeyBlob, IntPtr ppbSignatureBlob, IntPtr pcbSignatureBlob)
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)
Run Code Online (Sandbox Code Playgroud)
由于我的targetframework是v4而我的文件夹是"v4,C:\ Windows\Microsoft.NET\Framework\v4.0.30319",我检查了mscorsn.dll是否存在; 它存在.
那么,问题可能是什么?你能帮忙吗?
我有同样的问题,并设法解决它.
最初我生成了一个.PFX文件来在Visual Studio中签署我的程序集(使用项目属性窗口中的Signing选项卡).然后,我将.PFX文件中的公钥解压缩为.SNK文件(使用sn.exe).
当我尝试使用ILMerge.exe并使用生成的.SNK文件时,我会收到"Unable to load DLL 'mscorsn.dll'"错误.
我通过删除.PFX和生成的.SNK文件来修复它.然后,我生成了一个新的.SNK文件,如下所示(在VS中):
<New>这生成了一个新的.SNK文件,当我将该文件与ILMerge一起使用时,错误消失了.
HTH
| 归档时间: |
|
| 查看次数: |
2909 次 |
| 最近记录: |