我正在遵循这个教程,它解释了如何将构建后事件附加到项目中。
这是我的.bat
文件(尝试与没有D:
rem
d out):
CMD
ECHO parameter=%1
CD %1
rem D:
COPY WpfFileDeleter.exe temp.exe
"....ILMerge.exe" /out:"WpfFileDeleter.exe" "temp.exe" "Microsoft.WindowsAPICodePack.dll" "Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.dll" "Microsoft.WindowsAPICodePack.Sensors.dll" "Microsoft.WindowsAPICodePack.Shell.dll" "Microsoft.WindowsAPICodePack.ShellExtensions.dll"
DEL temp.exe
我还添加了这个ILMerge.exe.config
按照教程(我得到Unresolved assembly reference not allowed
错误):
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<requiredRuntime safemode="true" imageVersion="v4.0.30319" version="v4.0.30319"/>
</startup>
</configuration>
但是当我在VS中构建我的项目时,它只是在Output
中挂起这个消息:
1>------ Rebuild All started: Project: WpfFileDeleter, Configuration: Debug Any CPU ------
我可以看到一些文件被复制到bin/debug
,比如我指定的.dlls
和temp.exe
,但是任何WpfFileDeleter.exe
都不能正常运行,因为它没有被正确合并。
我的问题是我如何调试这个问题?是否有某种方式输出ILMerge或构建过程的结果,以便我可以看到它在哪里出错?
我能够通过在批处理文件中调用ILMerge
时指定targetFramework
来解决这个问题:
"....ILMerge.exe" /out:"WpfFileDeleter.exe" /targetPlatform:"v4" "temp.exe" "Microsoft.WindowsAPICodePack.dll" "Microsoft.WindowsAPICodePack.ExtendedLinguisticServices.dll" "Microsoft.WindowsAPICodePack.Sensors.dll" "Microsoft.WindowsAPICodePack.Shell.dll" "Microsoft.WindowsAPICodePack.ShellExtensions.dll"