I have inherited an AddIn project written in VB.NET and only works on C
++ projects.
Every time an item is selected within the IDE the following event is
captured
Public Shared WithEvents itemSelectionChanged As
EnvDTE.SelectionEvents
Within here they get the active project to them determine if its a
VCProject.
Given an object of Project, what is the best way to convert to
VCProject?
I have used the following code which seems to work but dont fully
understand the semantics of it, i mean why i need to put the call to
Object in where project is an instance of Project?
vc_project = CType(project.Object, VCProject)
When i try to do the same for VCConfiguration it throws an exception
Dim confg As EnvDTE.Configuration =
project.ConfigurationManager.ActiveConfiguration
Dim cfg As VCConfiguration = CType(confg.Object, VCConfiguration)
Does not work, throws exception ???
Have to use this instead
Dim cfg As VCConfiguration =
CType(prj.Configurations.Item(confg.ConfigurationName),
VCConfiguration)
But when I issue
Dim related As Boolean = confg.GetType().IsInstanceOfType(cfg)
MsgBox(CStr(related))
Get back true!
Can someone please clear up this issue for me?
How do you get the corresponding VC specific objects from the DTE2
general objects?
Herby - 22 Feb 2008 09:52 GMT
Hello anybody out there, with the Knowledge?
Let me greatly simplify the question I have posed above:
I have an event handler for the SelectionEvents.OnChange()
Given the DTE2 object,
How can I then get the current active VCProject and the
current active VCConfiguration ?
Arnie - 20 Apr 2008 07:14 GMT
If by "active" you mean "selected" since you are handling the
selectionEvents ....
The Solution.SolutionBuild.ActiveProjects (or something similar to this)
collection is the list of currently selected projects.
-arnie
> Hello anybody out there, with the Knowledge?
>
[quoted text clipped - 6 lines]
> How can I then get the current active VCProject and the
> current active VCConfiguration ?