Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS .Net: Post build events for "Primary Output from <myProject>" in installer project

I'm using the following post build actions in a project, to merge a lib into my application:

IF $(ConfigurationName) == Debug GOTO end
cp $(TargetPath) $(TargetDir)app_unmerged.exe
del $(TargetPath)
"C:\Program Files\Microsoft\ILMerge\ilmerge.exe" /internalize $(TargetDir)MyApp_unmerged.exe $(TargetDir)someLib.dll /out:$(TargetDir)myApp.exe
del $(TargetDir)myApp_unmerged.exe $(TargetDir)someLib.dll
:end

This works fine. Now I have an Installer project and added the Project Output. I would expect that the "Primary Output from " is used, i.e. the exe in /bin/Release . But actually instead of /bin/release/myApp.exe , /obj/release/myApp.exe is used.

Does anyone know if I can change this behavior and use the output in /bin/release for the installer project? Thanks.

like image 229
phatoni Avatar asked Oct 15 '22 16:10

phatoni


1 Answers

I solve the problem apply Ilmerge in /obj folder, this is my post-build event configuration:

COPY $(ProjectDir)obj\$(PlatformName)\$(ConfigurationName)\$(TargetFileName) $(TargetDir)temp.exe $(solutionDir)\lib\ilmerge /wildcards /t:exe /out:"$(ProjectDir)obj\$(PlatformName)\$(ConfigurationName)\$(TargetFileName)" "$(TargetDir)temp.exe" "$(TargetDir)log4net.dll" "$(TargetDir)other.dll" DEL $(TargetDir)temp.exe

like image 78
d.marzo Avatar answered Oct 19 '22 10:10

d.marzo