none
MSBuild execute batch file

    Question

  • how to execute a batch file with MSBuild in .proj file...

    i am trying to execute by exec command in the .proj file as...
    <Target Name="Portal_UnitTests">
        <Exec Command="C:\MSTEST.bat" ContinueOnError="false" />
    </Target>

     but it is throwing an error saying.... the command "C:\MSTEST.bat" exited with code 1...

    please help me to resolve this error or let me know how to execute using .proj file....
    Wednesday, April 22, 2009 12:26 PM

Answers

  • hey i could trace out the problem....the test result report should not exist when the batch file is being executed....

    initially i tried executing the batch file through command prompt so ESSUnitTestResults.trx was created and since this report exists...the execution through msbuild proj file is failing...when once i deleted the report file, it worked fine...

    thanks for your response...

    cheers :)
    • Marked as answer by Hua Chen Wednesday, April 29, 2009 5:33 AM
    Wednesday, April 22, 2009 1:24 PM

All replies

  • The batch file seems to get executed but it sets the error level to 1. Could you please post the content of the batch file?
    Wednesday, April 22, 2009 12:59 PM
  • here is the content of the batch file...

    "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe" /testcontainer:"C:\Portal\Code\Portal\Development\ESS1.0\Source\ESSUnitTests\bin\Debug\ESSUnitTests.dll" /resultsfile:"c:\ESSUnitTestResults.trx"

    thanks in advance...
    Wednesday, April 22, 2009 1:16 PM
  • hey i could trace out the problem....the test result report should not exist when the batch file is being executed....

    initially i tried executing the batch file through command prompt so ESSUnitTestResults.trx was created and since this report exists...the execution through msbuild proj file is failing...when once i deleted the report file, it worked fine...

    thanks for your response...

    cheers :)
    • Marked as answer by Hua Chen Wednesday, April 29, 2009 5:33 AM
    Wednesday, April 22, 2009 1:24 PM