Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / August 2005

Tip: Looking for answers? Try searching our database.

Trying to convert macros from VC 6.0 to .NET 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tcr - 17 Aug 2005 19:17 GMT
I'm having a problem finding a way to determine which project is the active
one.  In 6.0 there was an ActiveProject but that doesn't exist in the new
model.  I can iterate over the list of projects in the solution but not sure
how to determine which one is the active one.  Any help would be appreciated.
Thanks,
  tcr
"Ed Dore [MSFT]" - 18 Aug 2005 00:56 GMT
The DTE.ActiveSolutionProjects is probably what you're looking for here. It
returns a collection of the currently selected project(s).

Sincerely,
Ed Dore [MSFT]

This post is 'AS IS' with no warranties, and confers no rights.
tcr - 18 Aug 2005 13:31 GMT
Hi Ed,
  Thanks for the response.  That does give you the selected project or
projects but I was actually looking for how to find out what the current
startup project is.  Any further help would be appreciated.
   tcr

> The DTE.ActiveSolutionProjects is probably what you're looking for here. It
> returns a collection of the currently selected project(s).
[quoted text clipped - 3 lines]
>
> This post is 'AS IS' with no warranties, and confers no rights.
"Ed Dore [MSFT]" - 18 Aug 2005 21:37 GMT
You could try using the "StartupProject" property in the
DTE.Solution.Properties collection.

For example, using a macro, it would look something like the following:

   Function GetMiscDumpPane() As OutputWindowPane
       Dim ow As OutputWindow =
DTE.Windows.Item(Constants.vsWindowKindOutput).Object
       Dim pane As OutputWindowPane
       Try
           pane = ow.OutputWindowPanes.Item("MiscDumpPane!!!")
       Catch ex As System.ArgumentException
           pane = ow.OutputWindowPanes.Add("MiscDumpPane!!!")
       End Try
       Return pane
   End Function

   Sub FindStartupProject()
       Dim pane As OutputWindowPane = GetMiscDumpPane()
       Dim sp As Object =
DTE.Solution.Properties.Item("StartupProject").Value()
       pane.OutputString(sp)
   End Sub

Sincerely,
Ed Dore [MSFT]

This post is 'AS IS' with no warranties, and confers no rights.
tcr - 18 Aug 2005 21:50 GMT
Hi Ed,
 Thanks for the response, that was what I was looking for.  Is there
anyplace where the properties associated with a particular object are listed?
I tried searching for "StartupProject" but only got a reference to a bug.
  Thanks,
      tcr

> You could try using the "StartupProject" property in the
> DTE.Solution.Properties collection.
[quoted text clipped - 24 lines]
>
> This post is 'AS IS' with no warranties, and confers no rights.
"Ed Dore [MSFT]" - 19 Aug 2005 19:43 GMT
The documentation can be pretty lame when it comes to these properties.
I've made a habit of creating and run macros similar to the following to
identify the various properties that might be in a given set of properties.
Once you find something that looks promising, I check to see what the
property value is, and whether or not it'll be useful.

  Function GetMiscDumpPane() As OutputWindowPane
     Dim ow As OutputWindow =
DTE.Windows.Item(Constants.vsWindowKindOutput).Object
     Dim pane As OutputWindowPane
     Try
        pane = ow.OutputWindowPanes.Item("MiscDumpPane!!!")
     Catch ex As System.ArgumentException
        pane = ow.OutputWindowPanes.Add("MiscDumpPane!!!")
     End Try
        Return pane
   End Function

   Sub DumpProjectProperties()
       Dim pane As OutputWindowPane = GetMiscDumpPane()
       For Each project As EnvDTE.Project In DTE.Solution.Projects
           pane.OutputString("Properties for " & project.Name & vbCr)
           For Each prop As EnvDTE.Property In project.Properties
               pane.OutputString("    " & prop.Name & vbCr)
           Next
           For Each configProp As EnvDTE.Property In
project.ConfigurationManager.ActiveConfiguration.Properties
               pane.OutputString("        " & configProp.Name & vbCr)
           Next
       Next
   End Sub

   Sub DumpSolutionProps()
       Dim pane As OutputWindowPane = GetMiscDumpPane()
       For Each prop As [Property] In DTE.Solution.Properties
           pane.OutputString(prop.Name & vbCr)
       Next
   End Sub

Ed Dore [MSFT]

This post is 'AS IS' with no warranties, and confers no rights.
tcr - 19 Aug 2005 20:04 GMT
Hi Ed,
 Thanks for the help.  Do you know anyone that might be able to answer my
other post "Custom AppWizard Bug??" that I posted on 8/17 as well?  I had
originally posted this in a couple of other groups until I found this one but
haven't gotten any responses at all.
  tcr

> The documentation can be pretty lame when it comes to these properties.
> I've made a habit of creating and run macros similar to the following to
[quoted text clipped - 38 lines]
>
> This post is 'AS IS' with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.