Error with post-build event command
-
14-06-2021 - |
Question
I get an error, while compiling my C#-code with Visual Studio 2010 on Windows 7.
I have these Build Events (Post-build Event Command Line):
if not "$(ConfigurationName)"=="Release" goto :finish
"$(TargetDir)mt.exe" -manifest "$(ProjectDir)$(TargetName).exe.manifest" –outputresource:"$(TargetDir)$(TargetFileName)";#1
"$(ProjectDir)ILMerge.exe" /out:"$(TargetDir)Merged\Software.exe" "$(TargetPath)" "$(ProjectDir)bin\x86\Dlls\mwc.dll" "$(ProjectDir)bin\x86\Dlls\Interop.Access.dll" "$(ProjectDir)bin\x86\Dlls\Interop.DAO.dll"
:finish
If I remove: $(ProjectDir)bin\x86\Dlls\Interop.Access.dll
everything is fine. With this code, I get this error if I rebuild my code:
exited with code 1.
I think it didn't find the dll-file, but it is there. I have checked it for many times...
I have no idea how to fix that.
@edit: sorry, i've made a mistake, this is the right code now... it does'nt work anyway
Solution
You're missing a closing quote at the end of the $(ProjectDir)bin\x86\Dlls\Interop.Access.dll
"$(ProjectDir)ILMerge.exe" /out:"$(TargetDir)Merged\Software.exe" "$(TargetPath)" "$(ProjectDir)bin\x86\Dlls\mwc.dll" "$(ProjectDir)bin\x86\Dlls\Interop.Access.dll "$(ProjectDir)bin\x86\Dlls\Interop.DAO.dll"
Should be...
"$(ProjectDir)ILMerge.exe" /out:"$(TargetDir)Merged\Software.exe" "$(TargetPath)" "$(ProjectDir)bin\x86\Dlls\mwc.dll" "$(ProjectDir)bin\x86\Dlls\Interop.Access.dll" "$(ProjectDir)bin\x86\Dlls\Interop.DAO.dll"
OTHER TIPS
There is no easy way to debug post-build
scripts.
One of possible ways, I personally use, is execute suspicios line(s) separately in console and hopefully get more detailed explanation of what is going on there.
So try, for example, exeute ILMerge
with the command line arguments you use in post build event, and see what happens.
Good luck.