[MonoDevelop] Custom tools on multiple files

Michael Hutchinson m.j.hutchinson at gmail.com
Tue Jan 4 15:40:36 EST 2011


On Tue, Jan 4, 2011 at 3:51 AM, Federico Di Gregorio <fog at initd.org> wrote:
>> I would set a custom build action for these files - i.e. an msbuild
>> item type - then hook into the MD or msbuild build pipeline to
>> "compile" all files with this action. I might even add support for
>> additional item metadata that could be used to specify the target
>> compiled asset.
>
> Thank you very much for the suggestion. Do you have pointers to
> documentation that explains how to do that? Just the name of a file that
> implements this in MD would be fine.

For the non-xbuild version, see the IPhone addin for an example.
Subclass ProjectServiceExtension, and insert your extension somewhere
around the MidStep. Override Build and Clean - in each, you can first
call the base to delegate to the real build steps, then if it
succeeds, query the project's files for those with your custom build
action and compile them.

Doing it via xbuild is possibly better because it will work with
xbuild, msbuild and VS, but currently will only work with MD if you
enable "experimental xbuild support". Fo this, you simply need a
custom targets file. Define a custom target and inject its name into
the PrepareForRunDependsOn property. Its inputs would be
@(YourBuildAction) - the entire set of items with that action. Your
target can then invoke a task - either Exec or some custom task - to
do the compile. You may also wish to add the generated file to the
FileWrites items so it gets removed by a Clean.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list