Loading ...
Sorry, an error occurred while loading the content.

ProjectItem.get_Filenames

Expand Messages
  • Arild Fines
    I have code that looks something like this: UIHierarchyItem item; //... ProjectItem pitem = item.Object as ProjectItem; if ( pitem != null && pitem.FileCount
    Message 1 of 4 , Apr 1, 2003
    • 0 Attachment
      I have code that looks something like this:

      UIHierarchyItem item;

      //...

      ProjectItem pitem = item.Object as ProjectItem;
      if ( pitem != null && pitem.FileCount > 0 )
      {
      string filename = pitem.get_Filenames(0);

      ///...
      }

      If the UIHierarchyItem is something out of the ordinary, such as a Help
      Project item, a Setup Project item or a Solution item, the
      pitem.get_Filenames call fails with System.ArgumentException - "The
      parameter is incorrect".

      Why is this, and what can I do about it?

      --
      Arild Fines
    • Kevin Murphy
      I m not sure why you re seeing different behavior based on type of item, but I can point out one problem: collections are indexed starting at 1, not 0. This
      Message 2 of 4 , Apr 2, 2003
      • 0 Attachment
        I'm not sure why you're seeing different behavior based on type of
        item, but I can point out one problem: collections are indexed
        starting at 1, not 0. This might be the source of your problem.

        Kevin

        > -----Original Message-----
        > From: Arild Fines [mailto:arild.fines@...]
        > Sent: Tuesday, April 01, 2003 4:55 PM
        > To: vsnetaddin@yahoogroups.com
        > Subject: [vsnetaddin] ProjectItem.get_Filenames
        >
        >
        > I have code that looks something like this:
        >
        > UIHierarchyItem item;
        >
        > //...
        >
        > ProjectItem pitem = item.Object as ProjectItem;
        > if ( pitem != null && pitem.FileCount > 0 )
        > {
        > string filename = pitem.get_Filenames(0);
        >
        > ///...
        > }
        >
        > If the UIHierarchyItem is something out of the ordinary,
        > such as a Help
        > Project item, a Setup Project item or a Solution item, the
        > pitem.get_Filenames call fails with System.ArgumentException - "The
        > parameter is incorrect".
        >
        > Why is this, and what can I do about it?
        >
        > --
        > Arild Fines
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        > ---------------------~-->
        > Get 128 Bit SSL Encryption!
        > http://us.click.yahoo.com/W7NydA/hdqFAA/VygGAA/nhFolB/TM
        > ------------------------------------------------------------
        > ---------~->
        >
        > Replies go to the entire list. Visit
        > http://groups.yahoo.com/group/vsnetaddin to unsubscribe,
        > search message archives, or change delivery options.
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >
        >
      • Arild Fines
        ... Indeed you are correct(Collections starting at 1? Who has heard of such a thing...?;)). Strange that it did work for most items though. However, changing
        Message 3 of 4 , Apr 2, 2003
        • 0 Attachment
          > > I have code that looks something like this:
          > >
          > > UIHierarchyItem item;
          > >
          > > //...
          > >
          > > ProjectItem pitem = item.Object as ProjectItem;
          > > if ( pitem != null && pitem.FileCount > 0 )
          > > {
          > > string filename = pitem.get_Filenames(0);
          > >
          > > ///...
          > > }
          > >
          > > If the UIHierarchyItem is something out of the ordinary,
          > > such as a Help
          > > Project item, a Setup Project item or a Solution item, the
          > > pitem.get_Filenames call fails with System.ArgumentException - "The
          > > parameter is incorrect".
          >
          > I'm not sure why you're seeing different behavior based on type of
          > item, but I can point out one problem: collections are indexed
          > starting at 1, not 0. This might be the source of your problem.
          >

          Indeed you are correct(Collections starting at 1? Who has heard of such a
          thing...?;)). Strange that it did work for most items though.

          However, changing the index to 1 doesn't get me all the way:

          Now i'm getting a NullReferenceException from the pitem.get_Filenames(1)
          call for folders in the help project, as well as the "Detected dependencies"
          nodes in the Setup project.

          However, the Solution Items node works as expected. Shall I just assume that
          the people who implemented the automation model for the help and setup
          projects screwed up?

          --
          Arild
        • Craig Skibo
          The object model for Setup Projects and Help projects is not complete, are not fully supported, and are not documented as usable. You may be able to do some
          Message 4 of 4 , Apr 9, 2003
          • 0 Attachment
            The object model for Setup Projects and Help projects is not complete,
            are not fully supported, and are not documented as usable. You may be
            able to do some things with the object model for these projects, but not
            everything will work.

            Craig
            Inside Visual Studio .NET 2003
            http://www.microsoft.com/mspress/books/6425.asp
            <http://www.microsoft.com/mspress/books/6425.asp>


            ________________________________

            From: Arild Fines [mailto:arild.fines@...]
            Sent: Wednesday, April 02, 2003 10:05 AM
            To: Vsnetaddin


            > > I have code that looks something like this:
            > >
            > > UIHierarchyItem item;
            > >
            > > //...
            > >
            > > ProjectItem pitem = item.Object as ProjectItem;
            > > if ( pitem != null && pitem.FileCount > 0 )
            > > {
            > > string filename = pitem.get_Filenames(0);
            > >
            > > ///...
            > > }
            > >
            > > If the UIHierarchyItem is something out of the ordinary,
            > > such as a Help
            > > Project item, a Setup Project item or a Solution item, the
            > > pitem.get_Filenames call fails with System.ArgumentException - "The
            > > parameter is incorrect".
            >
            > I'm not sure why you're seeing different behavior based on type of
            > item, but I can point out one problem: collections are indexed
            > starting at 1, not 0. This might be the source of your problem.
            >

            Indeed you are correct(Collections starting at 1? Who has heard of such
            a
            thing...?;)). Strange that it did work for most items though.

            However, changing the index to 1 doesn't get me all the way:

            Now i'm getting a NullReferenceException from the pitem.get_Filenames(1)
            call for folders in the help project, as well as the "Detected
            dependencies"
            nodes in the Setup project.

            However, the Solution Items node works as expected. Shall I just assume
            that
            the people who implemented the automation model for the help and setup
            projects screwed up?

            --
            Arild



            Yahoo! Groups Sponsor
            ADVERTISEMENT

            <http://rd.yahoo.com/M=246920.2960106.4328965.1728375/D=egroupweb/S=1705
            007207:HM/A=1513704/R=0/*http://www.gotomypc.com/u/tr/yh/cpm/grp/300_02F
            /g22lp?Target=mm/g22lp.tmpl>

            <http://us.adserver.yahoo.com/l?M=246920.2960106.4328965.1728375/D=egrou
            pmail/S=:HM/A=1513704/rand=422791797>

            Replies go to the entire list. Visit
            http://groups.yahoo.com/group/vsnetaddin to unsubscribe, search message
            archives, or change delivery options.



            Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
            <http://docs.yahoo.com/info/terms/> .



            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.