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

[vsnetaddin] obtaining the currently selected project and determing its type

Expand Messages
  • Jamie Cansdale
    Hi Suzan, ... I can help you with finding the currently selected project. Do a search for selectedProject() here
    Message 1 of 3 , Mar 3, 2003
      Hi Suzan,

      > Therefore we need to obtain the currently selected project from
      > the solution explorer and determine whether it is a "web project"
      > or "web service project".
      >
      I can help you with finding the currently selected project. Do a search
      for 'selectedProject()' here
      <http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/nunitaddin/NUnitAddin/NU
      nitAddin/Connect/NUnitAddinConnect.cs?rev=1.53&content-type=text/vnd.vie
      wcvs-markup> . I use this method to find the selected project to run
      all unit tests in. More information about the project and how to get
      the rest of the source is available here
      <http://dotnetweblogs.com/NUnitAddin/Category/177.aspx?Name=NUnitAddin>
      .

      As for being able to determine whether it is a "web project" or "web
      service project. I'm not sure this is possible. I think they are both
      the same project type. The only difference is the template files they
      are initially populated with. It's perfectly possible to add a service
      to a web project and a page to a service project.

      Good luck, Jamie.

      ---
      Jamie Cansdale
      http://dotnetweblogs.com/nunitaddin




      -----Original Message-----
      From: suzangunay@... [mailto:suzangunay@...]
      Sent: 28 February 2003 10:57
      To: vsnetaddin@yahoogroups.com
      Subject: [vsnetaddin] obtaining the currently selected project and
      determing its type

      hi,

      We are starting to an add-Ins project in c#,we don't have enough
      knowledge about add-ins.
      We want to develop an addin that adds a special file(our template
      file) into the selected project only if the project is "web project"
      or "web service project".Therefore we need to obtain the currently
      selected project from the solution explorer and determine whether it
      is a "web project" or "web service project".

      Is there anyone to help us?

      thanks



      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/
    • Craig Skibo
      One other way of finding a selected project is to use the DTE.ActiveSolutionProjects property, which will return a list of projects that have one or more nodes
      Message 2 of 3 , Mar 5, 2003
        One other way of finding a selected project is to use the
        DTE.ActiveSolutionProjects property, which will return a list of
        projects that have one or more nodes (files, folders, etc) within the
        project selected, or if the project node is it's self selected.

        And, as Jamie suggests, there really is not a way of determining if a
        project is a web service or web project. After all, the only difference
        between a web application and a class library is that a web application
        is loaded into IIS, while a class library can be loaded into any .NET
        component. The only thing that I can think of for determining the
        difference is a few small hints that you can use, but they are not
        bullet proof. First, the "Enable ASP.NET Debugging" property for a
        project is true for a web service, while it is false for a class
        library. Also, for a web service, the "Start Page" property is set, but
        for a class library it is not set. Next, the "Web Settings" page is
        available for a web service, not a class library. You could check for
        the existence/values of these properties and make a best-guess as to if
        a project is a web service/app or a class library. Lastly, you could use
        the code model to walk the files in a project, looking for a class that
        derives from System.Web.Services.WebService, and if there is a class
        that does this, you could assume that the project is a web service
        project. Again, none of these methods are perfect, but they may suit
        your needs.


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


        ________________________________

        From: Jamie Cansdale [mailto:yahoo@...]
        Sent: Monday, March 03, 2003 6:29 AM
        To: vsnetaddin@yahoogroups.com


        Hi Suzan,

        > Therefore we need to obtain the currently selected project from
        > the solution explorer and determine whether it is a "web project"
        > or "web service project".
        >
        I can help you with finding the currently selected project. Do a search
        for 'selectedProject()' here
        <http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/nunitaddin/NUnitAddin/NU
        nitAddin/Connect/NUnitAddinConnect.cs?rev=1.53&content-type=text/vnd.vie
        wcvs-markup> . I use this method to find the selected project to run
        all unit tests in. More information about the project and how to get
        the rest of the source is available here
        <http://dotnetweblogs.com/NUnitAddin/Category/177.aspx?Name=NUnitAddin>
        .

        As for being able to determine whether it is a "web project" or "web
        service project. I'm not sure this is possible. I think they are both
        the same project type. The only difference is the template files they
        are initially populated with. It's perfectly possible to add a service
        to a web project and a page to a service project.

        Good luck, Jamie.

        ---
        Jamie Cansdale
        http://dotnetweblogs.com/nunitaddin




        -----Original Message-----
        From: suzangunay@... [mailto:suzangunay@...]
        Sent: 28 February 2003 10:57
        To: vsnetaddin@yahoogroups.com
        Subject: [vsnetaddin] obtaining the currently selected project and
        determing its type

        hi,

        We are starting to an add-Ins project in c#,we don't have enough
        knowledge about add-ins.
        We want to develop an addin that adds a special file(our template
        file) into the selected project only if the project is "web project"
        or "web service project".Therefore we need to obtain the currently
        selected project from the solution explorer and determine whether it
        is a "web project" or "web service project".

        Is there anyone to help us?

        thanks



        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/




        Yahoo! Groups Sponsor
        ADVERTISEMENT

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

        <http://us.adserver.yahoo.com/l?M=246920.2960106.4328965.2848452/D=egrou
        pmail/S=:HM/A=1464858/rand=955538972>

        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.