MSBuild execute bat file

Category: visual studio msbuild


markgoldin on Wed, 17 Dec 2014 11:46:19

In my proj file I need to modify <Exec Command="mxmlc.exe .....

to use mxmlc.bat. I did change the extension to bat but when proj file runs it does not do anything. Batch files are not executed. What am I doing wrong?



John Qiao on Thu, 18 Dec 2014 06:28:25

Hi Markgoldin,

Thanks for your post.

This issue relate to TFS? If yes, what’s the version of your TFS?

If this issue relate to MSBuild, please post it in MSBuild forum for the better response. Or I can help you move your initial post to MSBuild forum.

John Qiao on Fri, 19 Dec 2014 08:36:37

Hi Markgoldin, 

Have you conformed that? 

If there’s anything misunderstood, please describe your question in more detail and we will try to provide the better responses.

Anna Cc on Fri, 19 Dec 2014 09:37:03

Hi markgoldin,

>>but when proj file runs it does not do anything.

Did the proj file build ok? Did it tell you "Build succeeded" at the end? If your proj file can be build successfully, perhaps it execute the bat file but you didn't see the result. If the bat file was executed, what we can get or what we can see. If the proj file can't be run fine, I'm afraid that you need to modify it to make it run ok. If that is the case, I'm glad to help you check the script if you need my help.

I think we can troubleshot this issue in two aspects.

1.Since in you use "<Exec Command="mxmlc.bat......" in your script, please make sure that you have the file named "mxmlc.bat".

2. Add a line script, "<Exec Command="echo it is a test!" />" below "<Exec Command="mxmlc.bat .....". I write a simple sample for your reference:

 <Target Name="SetACL">
        <Exec Command="testbat.bat" />
        <Exec Command="echo it is a test!" />

In the testbat.bat file, there is one line "echo it is a test!". (I just write a simple command to test.)

Both of them are executed.

Even you post this issue in TFS build before, from the title, I guess that you use MSBuild.exe to build your script. After you add that line, you can check if the script run the Exec command in your script. If you can see that it output "it is a test!", it means that the script is ok, it can be build fine and you need to check your bat file. A strong possibility that it execute the bat file, but it shows nothing.

Best regards,

We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.