Search code examples
xamarinmonomonodevelopxamarin-studio

Monodevelop & Xamarin Studio addin project paths & templates


I'm writing an addin for Monodevelop and Xamarin Studio, and it's working, but I have had to hard encode some settings.

What objects do I query to get:

  • Templates available in the IDE.
  • Path to currently selected output (../bin/Debug).
  • Output executable filename.

Solution

  • Path to currently selected output (../bin/Debug).

    If you mean the active project configuration (if one is active...), you can get the currently selected configuration id in the IDE via:

    IBuildTarget buildTarget = MonoDevelop.Ide.IdeApp.ProjectOperations.CurrentSelectedBuildTarget;
    

    Assuming that your buildTarget is a DotNetProject, you can get list of the project's configurations that are available via:

    ((DotNetProject)buildTarget).Configurations
    

    DotNetProject Configurations have an OutputDirectory property that return a FilePath object.

    Output executable filename.

    Once you have the configuration that you need:

    DotNetProjectConfiguration.CompiledOutputName
    

    Templates available in the IDE.

    Templates are provided via the "/MonoDevelop/Ide/ProjectTemplates" Addin extension and there are solution, project, file templates, etc.. If you really need to enumerate all of them, look in

    [src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/][1]