Dear all,
When a any c++ project is opened in VS2005 I get a following sequence of
events.
event: BeforeClosing
event: BeforeClosing
event: ItemAdded,item name:Project9 kind:VCProject
event: ItemAdded,item name:Project9 kind:VCProject
event: ItemAdded,item name:Source Files kind:VCFilter
event: ItemAdded,item name:Source Files kind:VCFilter
event: ItemAdded,item name:main.cpp kind:VCFile
event: ItemAdded,item name:main.cpp kind:VCFile
event: ItemAdded,item name:Header Files kind:VCFilter
event: ItemAdded,item name:Header Files kind:VCFilter
event: ItemAdded,item name:test.h kind:VCFile
event: ItemAdded,item name:test.h kind:VCFile
event: ItemAdded,item name:Resource Files kind:VCFilter
event: ItemAdded,item name:Resource Files kind:VCFilter
m_SolutionEvents.Opened
m_SolutionEvents.Opened
Now withing solution events handler I have
Public Sub Open() Handles m_SolutionEvents.Opened
Console.writeline(" m_SolutionEvents.Opened")
console.writeline( _DTE2.ActiveSolutionProjects.Count.ToString);
If _DTE2.ActiveSolutionProjects.Count = 0 Then Return
...
Unfortunately _DTE2.ActiveSolutionProjects.Count is alwas 0. Strange, since
the project sgould be already active.
I also tried ParseStatus but it returns OK and has no influence on this
problem.
Any ideas how I can be notified when the project is active and ready to use?
Thanks a lot,
Boni
Boni - 05 Feb 2006 13:23 GMT
I found following at:
http://72.14.207.104/search?q=cache:Rz6uCJ-Z-74J:msdn.microsoft.com/chats/transc
ripts/vstudio/vside_jan_19_05.aspx+SolutionLoaded&hl=de&gl=de&ct=clnk&cd=3&clien
t=firefox-a
Has somebody already found a workaround?
Craig Skibo [MSFT] (Expert):
Q: SolutionEvents.SolutionOpened event is fired before solution is loaded in
VS2005. in VS2003, 2002, was fired after load. is this by design? is there a
way to catch an event that fires when the solution is completely loaded?
A: There were some changes necessary because of some changes to how
solutions are loaded in VS2005. VS 2005 loads projects async now for
performance reasons. When loading a solution with many projects, especially
if those projects are checked into a source code control system, VS could
become unresponsive. So the loading mechanism was changed to load the
solution file, then in the background load all the projects. We are still
firing the event at the same place (when the solution has finished opening),
the difference now is that the projects are not loaded until after the event
fires.
I can look into trying to either make the event fire the same way it did in
previous versions (preferred), or add a new event (not as ideal)