We are experiencing two issues using C# to extend Visual Studio 2003.
The solution being extended contains multiple Enterprise Templates (ETP)
that each contain one or more projects of various types.
The problem is that we need to extend the properties displayed in the
property browser when an ETP is selected in the Solution Explorer. We found
the CatID “{3B6A4DE6-2332-42b7-B6F6-0AF06993FFA2}” to extend the ETP when
referencing it in our code. However, we have been unable to find the CatID we
need to use when it is selected in the Solution Explorer.
We thought we found the CatID we needed, but there is still a problem casting
the ExtendeeObject that is being passed into the extender.
The CatID for an ETP when it is selected in the solution explorer is
“{E72203D8-B699-4723-8867-03E20F835499}”. To extend the properties of the ETP
we added a key in the registry to
“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Extenders\{E72203D8-B699-4723-8867-03E20F835499}”
Corresponding to our extender, namely “SolutionMisc”. In that key we set the
default value to “{D629F716-77FE-49cd-8F9A-564111B80AFF}”, the GUID for our
extender.
Our extender first check to make sure the object to be extended is what is
expected via the following function:
public bool CanExtend(string ExtenderCATID, string ExtenderName, object
ExtendeeObject)
{
//return true if it can extend the ExtendeeObject as an ETP
if (ExtenderCATID.ToUpper() == “{E72203D8-B699-4723-8867-03E20F835499”)
{
return true;
}
else
{
return false;
}
}
That is now returning true for Enterprise Templates. The next step is to
cast the ExtendeeObject passed as an object in to the method
public object GetExtender(string ExtenderCATID, string ExtenderName, object
ExtendeeObject, EnvDTE.IExtenderSite ExtenderSite, int Cookie)
To find out the type of the ExtendeeObject we used the following line
MessageBox.Show(Information.TypeName(ExtendeeObject));
This showed the type as being “IDispEFNode”.
The current problem is that IDispEFNode does not appear in any documentation
other than on one website
“http://custom.programming-in.net/articles/art14-2.asp?Interop=EFLib”, where
it is simply listed as a member of EFLib classes.
Where can we find this type, or is there another comparable type that will
work? Or how can we extend the ETP Properties ?
TIA
Shai
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!
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.
Hi Shai,
The IDispEFNode is defined in the typelib embedded in the ...Visual Studio
.Net 2003\EnterpriseFrameworks\msats10.dll. From the looks of it, the
Extendee only supports the Name, ExtenderNames, and ExtenderCATID
properties. In looking through the ETP project sources, I wasn't able to
find a way to link the Extendee to a specific EnvDTE.Project object.
Other project types expose additional properties (like FullName) that
allows us to search through the EnvDTE.Projects collection, but in this
instance, I don't see a way you could do that. By and large, it doesn't
look like the Enterprise Template projects avail themselves to the VS
extensibility/automation model. At least, they don't support the extent of
properties and methods other project types do.
From the looks of it, I can't see a scenario where we could add persistent
properties to an ETP project. There doesn't appear to be a way to persist
any extender properties into the project file (usually done using
Project.Globals).
I'll ask around though and see if I can come up with any additional
suggestions, but my initial suspicion is that this simply isn't possible.
Sincerely,
Ed Dore [MSFT]
This post is 'AS IS' with no warranties, and confers no rights.
Shai - 04 May 2006 23:54 GMT
Hi Ed !
Thanks for the information.
I'll be happy if you'll find direct support for the properties extender.
Work around will be to add commandbarbutton to ETP as you describe in my
other problem and call in depended property page.
TIA
Shai
> Hi Shai,
>
[quoted text clipped - 23 lines]
>
> This post is 'AS IS' with no warranties, and confers no rights.
"Ed Dore [MSFT]" - 04 May 2006 23:57 GMT
Hi Shai,
In thinking about this a bit more, one option you may be able to use, if
the project names in the solution are unique.
From your IExtenderProvider.GetExtender implementation, you could do
something like the following, when constructing your extender objects:
public object GetExtender(string ExtenderCATID, string ExtenderName, object
ExtendeeObject, IExtenderSite ExtenderSite, int Cookie)
{
if (CanExtend(ExtenderCATID, ExtenderName, ExtendeeObject))
{
// retrieve Name property from ExtendeeObject
PropertyDescriptor propDesc =
TypeDescriptor.GetProperties(ExtendeeObject)["Name"];
string name = propDesc.GetValue(ExtendeeObject) as string;
// get DTE from ExtenderSite (alternatively you could use the
applicationObject in an addin project)
ObjectExtenders objExtenders = ExtenderSite as ObjectExtenders;
DTE dte = objExtenders.DTE;
// find corresponding EnvDTE.Project object, note this returns the
first one found
foreach (Project p in dte.Solution.Projects)
{
if (p.Name == name)
return new ETPExtender(p, ExtenderSite, Cookie);
}
}
return null;
}
This allows you to pass the corresponding EnvDTE.Project to each extender
object, which will provide you with a bit more functionality, such as
persisting the extender's properties via the Project.Globals object.
Sincerely,
Ed Dore [MSFT]
This post is 'AS IS' with no warranties, and confers no rights.
Shai - 07 May 2006 09:46 GMT
Hi Ed !
Thanks for the solution , this working.
Shai
> Hi Shai,
>
[quoted text clipped - 39 lines]
>
> This post is 'AS IS' with no warranties, and confers no rights.