[MonoDevelop] This collection does not exist!

Michael Hutchinson m.j.hutchinson at gmail.com
Sat Sep 13 12:18:22 EDT 2008

On Thu, Sep 11, 2008 at 11:06 AM, laas <laas.mono at gmail.com> wrote:
> Hi all,
> developing my own MonoDevelop addin I'm trying to find a way to loop through
> all solution's documents. After a lot of days spent to read MD source code
> I've found the following file:
> WholeProjectDocumentIterator.cs
> that contains the following instructions:
> foreach (Document document in IdeApp.Workbench.Documents) {
> ...
> }
> but I'm sure this will loop only through opened documents. So I think that
> MD core does not provides a collection of all document of a
> solution/project.
> Is this right ?

AFAIK yes. You'll need to do something like

foreach (WorkspaceItem item in IdeApp.Workspace.Items)
    if (item is Project)
        foreach (ProjectFile file in ((Project)item).Files)
            Console.WriteLine (file.FilePath);

Michael Hutchinson

More information about the Monodevelop-list mailing list