locked
How add a page property to project's properties in VS2010? RRS feed

  • Question

  • I'm trying to develop a new tab for project's properties, something like build / debug / signing / code analysis etc.

    The only way I found it's making a sub type project, but I dont want that I need add a custom tab (page property) to every C# project, I try register my sub type project with the typeid guid used by c# projects to force every c# project use my custom page property but as expected, this doesn't work.

    Some one could help me with this? I tried everything I found in MSDN forums and not work, only work with subtype project work around.

    Thanks for your time :)

    Thursday, June 21, 2012 3:30 PM

Answers

  • Hi Sergio,

    Unfortunately, that's how the project properties designer is implemented. The project settings are surfaced through the project system. There is no mechanism that allows for adding ad-hoc/stand-alone property pages to the project settings designer. The pages displayed are controlled by the project system, and the only way add/remove pages has to be done from the project type itself. Which means, you either implement your own project type, or subtype an existing project type, so you can specify the page guids via the VSHPROPID_PropertyPagesCLSIDList or VSHPROPID_CfgPropertyPagesCLSIDList.

    The only other option I can think of would be to expose your properties via an IExtenderProvider. I wrote an addin years ago for VS 2003, where I added an additional property to the VB and C# project nodes in Solution Explorer. If I recall correctly, the addin actually handled the PostBuild event, and would spawn off a secondary process that signed the binary, based on the added property setting. (that functionality has long since been integrated directly into the build process).

    You could do something like that from either a package or an addin. Though I'm not sure if that would fit your specific needs. Feel free to post some details as to what sort of properties you are trying to surface here, and how you plan on dealing with them.

    Sincerely,


    Ed Dore

    Friday, June 22, 2012 5:17 PM

All replies

  • Hi Sergio,

    Unfortunately, that's how the project properties designer is implemented. The project settings are surfaced through the project system. There is no mechanism that allows for adding ad-hoc/stand-alone property pages to the project settings designer. The pages displayed are controlled by the project system, and the only way add/remove pages has to be done from the project type itself. Which means, you either implement your own project type, or subtype an existing project type, so you can specify the page guids via the VSHPROPID_PropertyPagesCLSIDList or VSHPROPID_CfgPropertyPagesCLSIDList.

    The only other option I can think of would be to expose your properties via an IExtenderProvider. I wrote an addin years ago for VS 2003, where I added an additional property to the VB and C# project nodes in Solution Explorer. If I recall correctly, the addin actually handled the PostBuild event, and would spawn off a secondary process that signed the binary, based on the added property setting. (that functionality has long since been integrated directly into the build process).

    You could do something like that from either a package or an addin. Though I'm not sure if that would fit your specific needs. Feel free to post some details as to what sort of properties you are trying to surface here, and how you plan on dealing with them.

    Sincerely,


    Ed Dore

    Friday, June 22, 2012 5:17 PM
  • Thank you 
    Monday, June 25, 2012 6:57 AM