Reputation: 10400
I am following this tutorial which explains how to attached post-build events to a project.
This is my .bat
file (tried with and without the 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
And I also added this ILMerge.exe.config
as per the tutorial (I was getting the Unresolved assembly reference not allowed
error):
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<requiredRuntime safemode="true" imageVersion="v4.0.30319" version="v4.0.30319"/>
</startup>
</configuration>
But when I build my project in VS it just hangs with this message in Output
:
1>------ Rebuild All started: Project: WpfFileDeleter, Configuration: Debug Any CPU ------
I can see that some files have been copied to bin/debug
, such as the .dlls
I specified and temp.exe
, but any WpfFileDeleter.exe
s cannot be run properly as it has not been merged properly.
My question is How can I debug this issue? Is there some way of outputting the results of ILMerge or the build process so that I can see where it is going wrong?
Upvotes: 0
Views: 325
Reputation: 10400
I was able to resolve this by specifying the targetFramework
when calling ILMerge
in the batch file:
"..\..\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"
Upvotes: 1