PC Review


Reply
Thread Tools Rate Thread

Re: Addin - context menu - target project name

 
 
Roman S. Golubin
Guest
Posts: n/a
 
      14th Nov 2003

Hello, seeni

> I have added a custom menuitem in the context menu (See attachment) to

the
> solution explorer
> for a project. I require to read the target project name on clicking the
> menu. I am unable to find any classes/functions to get the target project
> name(MBRClass - in my case) and project kind(CSproj or VBproj).


Try this code:

Imports EnvDTE

Public Module Test

Sub PrintProjNames()
Dim projs As System.Array
Dim proj As Project
projs = DTE.ActiveSolutionProjects()
For Each proj In projs
MsgBox(proj.Name)
Next
End Sub
End Module



 
Reply With Quote
 
 
 
 
seeni
Guest
Posts: n/a
 
      14th Nov 2003
Golubin,
Your solution is not working.

I found the following code in MSDN which works

Private Function GetCurrentlySelectedProject() As EnvDTE.Project
Dim selItems As EnvDTE.SelectedItems
Dim selItemObj, selItem As EnvDTE.SelectedItem
Dim selProject As EnvDTE.Project

selItems = Me.m_application.SelectedItems
' List the number of items selected.
If selItems.Count > 0 And Not selItems.MultiSelect Then
' Set a reference to the first selected item.
selItemObj = selItems.Item(1)

' List the names of the project
' or project items under the selected
' item.
For Each selItem In selItemObj.Collection
If TypeOf selItem.Project Is EnvDTE.Project Then
selProject = selItem.Project
Else
If TypeOf selItem.ProjectItem _
Is EnvDTE.ProjectItem Then
If TypeOf selItem.ProjectItem.ContainingProject _
Is EnvDTE.Project Then
selProject = selItem.ProjectItem.ContainingProject
End If
End If
End If
Next
End If
Return selProject
End FunctionThanks,-Seeni
"Roman S. Golubin 1709176985" <(E-Mail Removed)> wrote in message
news:bp2l0m$qi3$(E-Mail Removed)...
>
> Hello, seeni
>
> > I have added a custom menuitem in the context menu (See attachment) to

> the
> > solution explorer
> > for a project. I require to read the target project name on clicking the
> > menu. I am unable to find any classes/functions to get the target

project
> > name(MBRClass - in my case) and project kind(CSproj or VBproj).

>
> Try this code:
>
> Imports EnvDTE
>
> Public Module Test
>
> Sub PrintProjNames()
> Dim projs As System.Array
> Dim proj As Project
> projs = DTE.ActiveSolutionProjects()
> For Each proj In projs
> MsgBox(proj.Name)
> Next
> End Sub
> End Module
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Addin - context menu - target project name Roman S. Golubin Microsoft VB .NET 1 14th Nov 2003 05:25 PM
Re: Addin - context menu - target project name Roman S. Golubin Microsoft C# .NET 1 14th Nov 2003 05:25 PM
Re: Addin - context menu - target project name Jim Butler Microsoft VB .NET 1 14th Nov 2003 04:44 PM
Re: Addin - context menu - target project name Jim Butler Microsoft Dot NET Framework 1 14th Nov 2003 04:44 PM
Re: Addin - context menu - target project name Jim Butler Microsoft C# .NET 1 14th Nov 2003 04:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:37 PM.