Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to make a project with post-build script work on MonoDevelop and Visual Studio?

Tags:

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?

like image 306
Earlz Avatar asked Oct 31 '12 03:10

Earlz


People also ask

How do I create a post-build event in Visual Studio?

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.

Is Monodevelop the same as Visual Studio?

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.

How do I debug a post-build event in Visual Studio?

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.

What is post-build script?

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.


1 Answers

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

like image 186
piers7 Avatar answered Sep 19 '22 03:09

piers7