Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 使用ILMerge错误生成_.net_Msbuild_Build_Ilmerge - Fatal编程技术网

.net 使用ILMerge错误生成

.net 使用ILMerge错误生成,.net,msbuild,build,ilmerge,.net,Msbuild,Build,Ilmerge,是否有人在IlMerge中出现此错误?我正在尝试使用4.0框架合并.NET项目的几个程序集 ILMerge/log/lib:…\Libraries/targetplatform:v4/internalize:…\SolutionFiles\CJCommon.exclude/ndebug/out:bin\Release\Common.dll obj\Release\Common.dll C:\Development\CJCommon\Libraries\FluentNHibernate.dll C

是否有人在IlMerge中出现此错误?我正在尝试使用4.0框架合并.NET项目的几个程序集

ILMerge/log/lib:…\Libraries/targetplatform:v4/internalize:…\SolutionFiles\CJCommon.exclude/ndebug/out:bin\Release\Common.dll obj\Release\Common.dll C:\Development\CJCommon\Libraries\FluentNHibernate.dll C:\Development\CJCommon\Libraries\hibernate\hibernate\hibernate\hibernate\hibernate\hibernate.dllC:\Development\CJCommon\Libraries\log4net.dll C:\Development\CJCommon\Libraries\Microsoft.Practices.ServiceLocation.dll C:\Development\CJCommon\Libraries\NHibernate.dll C:\Development\CJCommon\Libraries\NHibernate.Linq.dll C:\Development\CJCommon\Libraries\StructureMap.dll

使用mscorlib.dll的目录“C:\Windows\Microsoft.NET\Framework64\v2.0.50727..\v4.0.20107”,将平台设置为“v4”

合并期间发生异常:

对象引用未设置为对象的实例

 at System.Compiler.CoreSystemTypes.GetSystemAssembly(Boolean doNotLockFile, Boolean getDebugInfo)
 at System.Compiler.CoreSystemTypes.Initialize(Boolean doNotLockFile, Boolean getDebugInfo)
 at System.Compiler.SystemTypes.Initialize(Boolean doNotLockFile, Boolean getDebugInfo)
 at ILMerging.ILMerge.Merge()
 at ILMerging.ILMerge.Main(String[] args)
C:\Program Files(x86)\MSBuild\Ilmerge.CSharp.targets(8,5):错误MSB3073:命令“C:\Program Files(x86)\Microsoft\Ilmerge\Ilmerge.exe”/log/lib:“…\Libraries”/targetplatform:v4/internalize:./。已退出,代码为1


=========全部重建:3个成功,1个失败,0个跳过========

在targetplatform中包括4.0框架的路径,并确保使用引号。例如,从PowerShell:

.\ILMerge /out:Merged.dll /targetplatform:'v4,C:\Windows\Microsoft.NET\Framework\v4.0.30319' .\Assembly1.dll .\Assembly2.dll

我回答这个老问题是因为我没有找到我自己关于堆栈溢出的相关问题的答案,这可能会帮助其他人。在我的情况下,我试图在VS2013中接触并重建一个旧的解决方案,以修复安装程序中的一个小故障(不承认IIS10比IIS4更新)

合并操作给了我一个“系统找不到指定的文件错误代码0x80070002”,如果忽略该错误并安装应用程序,它将遇到运行时异常。当然,“指定的文件”就在生成文件夹中

这个问题的根本原因是4.0之后的框架是“就地升级”,其中一些依赖项在核心库中移动(有关详细讨论,请参阅:)。长话短说,您可能有多个版本的ilmerge可供使用,但只有最新版本才能保证能够准确地解除对依赖项的缓冲,以便在运行时找到相关内容,丢失的不是指定的文件,而是指向基础调用的指针

在我的案例中,解决方案是找到从NuGet检索到的ilmerge版本,并从我的旧解决方案中引用该版本,同时保留所有其他内容不变。(我本应该知道这一点,但我当时很匆忙/没有直截了当地思考,错误消息具有误导性…。

可能重复的