Click here to Skip to main content
15,885,182 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I want to run a bat file on my project build. So I set the pre-build event command line as follows.

$(ProjectDir)\build.bat


However, seems it is not working. Can anybody give me a clue to solve it.

BTW, I am using VS 2008 and the project is C# console app.

Thanks in advance.
Posted
Updated 26-Dec-21 5:07am

it is not working
This gives us absolutely nothing to go on.

I would suggest you edit your project so the event reads:
echo $(ProjectDir)\build.bat

That should help you to figure out what may be happening. You should also check your build output screen and logs for any error or warning messages.
 
Share this answer
 
Comments
CodingLover 20-Feb-12 22:00pm    
Actually what my bat file does is compile a *.chm file, a help package to my project. So all the page in place and once I double-click on the bat it create the help successfully, without any error.

However as I mention above once I build the project it says "Unable to open Help.hhp" which is my config file. Any idea why it is really happens?
Richard MacCutchan 21-Feb-12 3:52am    
Well I guess the file may be in use, the path is incorrect, the filename is spelled wrong ...
You need to do some closer examination of your parameters to see why.
CodingLover 21-Feb-12 4:11am    
Here what I have tried,

Simply print the path of the file and it is available in the relevant path. So no issue was there.

I couldn't find a direct way to identify that my hhp file is in use by another app. Simply restart the PC and still didn't work. However, if I double click on my bat file it is successfully compiled and create the chm file.
Richard MacCutchan 21-Feb-12 5:17am    
There must still be something amiss with your configuration or settings. Where does this message get produced from, and have you checked the logs from this part of the build?
$(ProjectDir) variable already contains trailing slash '\'. Thus you should not write it again. Try to use the following string:
$(ProjectDir)build.bat
 
Share this answer
 
Comments
CodingLover 20-Feb-12 22:02pm    
It doesn't work.
Richard MacCutchan 21-Feb-12 3:54am    
Stop saying "It doesn't work." in response to suggestions. How can you expect people to help you if the best you can do is respond with this useless piece of non-information? Try and help yourself by collecting some useful diagnostic information, and explain exactly what happens.
CodingLover 21-Feb-12 4:08am    
I am just replying on what that OP suggest, not asking any question in that particular post mate.
Richard MacCutchan 21-Feb-12 5:15am    
Yes, and as I pointed out, your reply is pointless as it conveys no information whatsoever.
I think excluding the slash should be half of the problem. Also, if your path contains spaces, surround the whole thing with double quotes so it ends up like this:

"$(ProjectDir)build.bat"

This should work.
 
Share this answer
 
v2
you need to use the call command and loose the trailing slash

call $(ProjectDir)build.bat
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900