I'm using a pre-build event in Visual Studio to run a batch (.bat) file that performs some code generation (specifically, I'm running SqlMetal.exe to generate LinqToSql code).
Is the batch file guaranteed to finish before the compilation begins? Or does it run the batch asynchronously?
Bottom line: I want to make sure the new code gets compiled, not the old code.
If it's not guaranteed -- what solutions are available?
Yes. But note that if you have more than one step in your pre-build, only the last step will be checked for errors. See Gotcha! Visual Studio Pre/Post-Build Events for more info.
The batch file will complete only after the process it has started has itself completed, unless you use the start command in the batch file. As a simple test, you could just create a batch file like this:
notepad.exe
And set that as your pre-build event. You will see that the build starts only after you shut down notepad.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With