Extending C#/VB Project Properties

Hi!
I have already posted the following question but here is a more precise description of what I am going to do:
I would like to extend the existing C# and VB project types with my own property page and to persist some settings in the project file through Project.Globals.
My property page should be a new tab or category in the Project -> Properties dialog. I read already about project subtypes, but I think this approach has too much overhead. I only want to extend the existing project types (e.g. C# projects: Windows Application, Class Library...) without creating a new subtype. And I don't want to view my settings in the property grid if the project node in the solution explorer is selected. I already evaluated the IExtenderProvider sample of the VS Automation Samples, but this is not what I want. Can anybody help me?
Kind regards,
Sebastian
[946 byte] By [SebastianKralemann] at [2008-3-5]
# 1

Hello Sebastian,

I think what you want is in the project flavor sample that ships with VSIP.

If you open the c:\Program Files\VSIP 8.0\EnvSDK\CS_Samples\ProjectSubtype\ProjectSubtype.sln.
DeployPropertyPage.cs - a custom property page.
Project.cs - (the flavored project) has a GetProperty() method which changes the pages shown.

/// <summary>
/// Overriding this method as we want to filter some of the properties
/// For properties we don't want to handle, let the base class delegate
/// to the inner project
/// </summary>
protected override int GetProperty(uint itemId, int propId, out object property)
{
switch (propId)
{
case (int)__VSHPROPID2.VSHPROPID_CfgPropertyPagesCLSIDList:
{
// TODO: this is were we add/remove Configuration specific property pages.
// implementation should be similar to the one for __VSHPROPID2.VSHPROPID_PropertyPagesCLSIDList

// Get the list from the base class
ErrorHandler.ThrowOnFailure(base.GetProperty(itemId, propId, out property));

// Add our Deployment Property Page
Debug.Assert(typeof(IPropertyPage).IsAssignableFrom(typeof(DeployPropertyPage)), "Property page should implement IPropertyPage");
property += ';' + typeof(DeployPropertyPage).GUID.ToString("B");

return VSConstants.S_OK;
}

}
return base.GetProperty(itemId, propId, out property);
}

Best regards,
Daren.

DarenYong at 2007-9-8 > top of Msdn Tech,Visual Studio,Visual Studio Extensibility...

Visual Studio

Site Classified