I have an open source project in which I'm trying to allow development on both MonoDevelop(including *nix) and Visual Studio. One of my recently discovered requirements is I need to copy an outputted file from one directory to another(relative path).
Windows however has the copy
command, while *nix has the cp
command. What is the best way to get this to work on both platforms and resolve this difference of commands?
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.
Visual Studio is a suite having component-based software development tools for building applications for devices, cloud, etc. Monodevelop is comparatively faster, lighter so eats very less resources. So the application runs fast on it. Visual Studio is slower and heavier than Monodevelop.
Another way is to check the bin\debug dir for 'PreBuildEvent. bat' or 'PostBuildEvent. bat' which are the file that Visual Studio creates and run during the build events, if there is an error the files remain in the output dir and you can run them manually and spot the error.
The post-build script runs after the build has finished and copied all the necessary artifacts to the output directory. The post-build script will run even if the build fails.
Where possible, if you can lean on built-in MSBuild tasks rather than custom shell scripting, the behavior will generally work on xbuild (and hence MonoDevelop?) without any changes, so no need for platform-specific *proj hacks.
eg:
<Target Name="AfterBuild"> <Copy SourceFiles="foo.txt" DestinationFolder="$(OutDir)" /> </Target>
This is from the mono docs: http://www.mono-project.com/archived/porting_msbuild_projects_to_xbuild/#prepostbuildevents
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