Good morning,
We are attempting to integrate a proprietary source control management
system into Visual Studio 2003. To accomplish this goal we need to capture
and retrieve information from several events including add reference and add
existing item. It is in these two events that we are having difficulty.
As with all events we are able to catch the event before and after it runs
via the following code:
public void BeforeExecute(string Guid, int ID, object CustomIn, object
CustomOut, ref bool CancelDefault)
{
string commandName = "";
commandName = applicationObject.Commands.Item(Guid, ID).Name;
if (commandName == "Project.AddReference")
outputWindowPane.OutputString("File.AddReference \n");
if (commandName == "File.AddExistingItem")
outputWindowPane.OutputString("File.AddExistingItem\n");
}
And
public void AfterExecute(string Guid, int ID, object CustomIn, object
CustomOut)
{
string commandName = "";
commandName = applicationObject.Commands.Item(Guid, ID).Name;
if (commandName == "Project.AddReference")
outputWindowPane.OutputString("Project.AddReference\n");
if (commandName == "File.AddExistingItem")
outputWindowPane.OutputString("File.AddExistingItem\n");
}
The problem arises after we have detected the user is adding a reference or
an existing object. There is no apparent way to know what has actually been
added. Any insight you can offer on how to find this information would be
greatly appreciated.
TIA
Shai
"Gary Chang[MSFT]" - 08 May 2006 11:06 GMT
Hi Shai,
Thank you posting!
This is a quick note to let you know that I am performing research on this
issue and will get back to you as soon as possible. I appreciate your
patience.
Thanks for your understanding.
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
"Gary Chang[MSFT]" - 09 May 2006 08:33 GMT
Hi Shai,
The usual solution to this problem is to handle the DTE's
ReferencesEvents.ReferenceAdded event (and the ProjectItemsEvents.ItemAdded
event). With tha you can retrieve the information of the added reference
object.
Please refer to the following MSDN doc for the further information:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vxlrfvslangprojvsprojecteventsreferencesevents.asp
Thanks!
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Shai - 10 May 2006 06:43 GMT
Hi Gary !
We tried to implement the ReferencesEvents.ReferenceAdded event, but we
couldn’t find it. When I checked the MSDN article you included it was talking
about VS 2005. In my original message I wrote that we are working on "Visual
Studio .net 2003" . Is there a VS 2003 equivalent or work around ?
TIA
Shai
> Hi Shai,
>
[quoted text clipped - 19 lines]
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
Dustin Campbell - 10 May 2006 13:37 GMT
Hi Shai,
This is actually not available explicitly from EnvDTE.DTE or EnvDTE.DTE.Events.
Add a reference to VSLangProj to your project. Then, cast the EnvDTE.Project.Object
property value to VSLangProj.VSProject. From that object you can access VSProject.Events.ReferencesEvents.
There are three events available ReferenceAdded, ReferenceChanged and ReferenceRemoved.
Best Regards,
Dustin Campbell
Developer Express Inc
Shai - 15 May 2006 12:11 GMT
Hi Dustin !
Thanks for your information , this solve the problem.
TIA
Shai
> Hi Shai,
>
[quoted text clipped - 6 lines]
> Dustin Campbell
> Developer Express Inc
"Gary Chang[MSFT]" - 11 May 2006 09:07 GMT
Hi Shai,
That ReferenceAdded event also exsited in VS2003, you can follow Dustin's
suggestion to handle it in your VS2003 project.
Thanks!
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.