你使用ILMerge吗?您是否使用ILMerge合并多个程序集以简化动态链接库的部署?在ILMerging组装之后,您是否发现生产环境中的部署/版本控制存在问题?
我正在寻找一些关于使用ILMerge减少部署摩擦的建议,如果这是可能的话。
发布于 2008-08-29 06:00:06
我几乎所有不同的应用程序都使用ILMerge。我将它集成到发布构建过程中,所以我最终得到的是每个应用程序一个可执行文件,而不需要额外的dll。
您不能ILMerge任何具有本机代码的C++程序集。你也不能ILMerge任何包含XAML for WPF的程序集(至少我还没有在这方面取得任何成功)。它会在运行时抱怨资源无法定位。
我确实为ILMerge编写了一个包装可执行文件,其中传入了要合并的项目的启动可执行文件名称和输出可执行文件名称,然后它将反映依赖程序集并使用适当的命令行参数调用ILMerge。现在,当我向项目中添加新的程序集时,它变得容易多了,我不必记得更新构建脚本。
发布于 2012-03-20 18:23:39
引言
这篇文章展示了如何用一个combined .exe替换所有的.exe + .dll files。它还保持了调试.pdb文件的完整性。
对于控制台应用程序
这是Visual Studio2010 SP1的基本Post Build String,使用.NET 4.0。我正在构建一个控制台.exe,其中包含所有的子.dll文件。
"$(SolutionDir)ILMerge\ILMerge.exe" /out:"$(TargetDir)$(TargetName).all.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll" /target:exe /targetplatform:v4,C:\Windows\Microsoft.NET\Framework64\v4.0.30319 /wildcards基本提示
AssemblyName.all.exe“文件,它将所有子.exe合并到一个dll中。ILMerge\目录。您需要将ILMerge实用程序复制到您的解决方案目录中(这样您就可以分发源代码,而不必担心记录ILMerge的安装),或者将此路径更改为指向ILMerge.exe所在的位置。高级提示
如果遇到无法工作的问题,请启用Output,然后选择Show output from: Build。检查Visual Studio实际生成的确切命令,并检查错误。
示例构建脚本
此脚本使用单个combined .exe替换所有.exe + .dll files。它还保持了调试.pdb文件的完整性。
要使用此命令,请将其粘贴到C#项目中Build Events选项卡下的Post Build步骤中,并确保将第一行中的路径调整为指向ILMerge.exe
rem Create a single .exe that combines the root .exe and all subassemblies.
"$(SolutionDir)ILMerge\ILMerge.exe" /out:"$(TargetDir)$(TargetName).all.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll" /target:exe /targetplatform:v4,C:\Windows\Microsoft.NET\Framework64\v4.0.30319 /wildcards
rem Remove all subassemblies.
del *.dll
rem Remove all .pdb files (except the new, combined pdb we just created).
ren "$(TargetDir)$(TargetName).all.pdb" "$(TargetName).all.pdb.temp"
del *.pdb
ren "$(TargetDir)$(TargetName).all.pdb.temp" "$(TargetName).all.pdb"
rem Delete the original, non-combined .exe.
del "$(TargetDir)$(TargetName).exe"
rem Rename the combined .exe and .pdb to the original project name we started with.
ren "$(TargetDir)$(TargetName).all.pdb" "$(TargetName).pdb"
ren "$(TargetDir)$(TargetName).all.exe" "$(TargetName).exe"
exit 0发布于 2008-08-14 13:00:50
我们在微软的应用程序块上使用ILMerge,而不是12个单独的DLL文件,我们只有一个文件可以上传到我们的客户端区域,而且文件系统结构要整洁得多。
合并文件后,我必须编辑visual studio项目列表,删除12个单独的文件并添加单个文件作为引用,否则它会抱怨找不到特定的程序集。我不太确定这将如何在部署后工作,但可能值得一试。
https://stackoverflow.com/questions/9376
复制相似问题