I have a pre-build event as follows:
ver
if %errorlevel% EQU 0 (
REM some code
) else (
REM some code
)
When running this on a mac os machine, ver command throws an error. How can I make this code run on both mac and windows?
Go to Solution Explorer and right-click on the project then select Properties then go to the Build Events tab.
In the Post-build event command line box, specify the syntax of the build event. Add a call statement before all post-build commands that run . bat files. For example, call C:\MyFile.
PostBuildEvent. This event executes after the build finishes. The following table lists each use-in-build element: XML Element.
To compile source files from within the Visual Studio IDE, choose the Build command from the Build menu. When you build project files by using the Visual Studio IDE, you can display information about the associated vbc command and its switches in the output window.
OK, so I ended up solving the problem by writing two versions of the same script, one for windows, the other for bash/mac. Firstly, I added the following to my pre-build event in visual studio:
NOTE: The lack of an extension is on purpose.
Then I added two scripts, one called GenerateConfig.cmd for windows builds. The other script called GenerateConfig for mac builds. You'll also need to make sure the later script has the execute flag on it.
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