I'm writing a visual studio Add-In that will activate when the debugger is launched. The Add-In needs to check the Project settings of the currently running proj开发者_StackOverflow中文版ect and read specifically the check boxes on the Web tab at the bottom of that tab where it says Debuggers. I would like to read the project settings each time and determine which check boxes are checked everytime the debugger is launched the "ASP.NET" "Native Code" "SQL Server" "Silverlight" "Enable Edit and Continue" checkboxes.
I've gone through the examples in the SDK haven't found anything that specifically read the project settings. If anybody could point me in the right direction that would be helpful.
It turns out that the answer is easier than I thought. The Web Configuration in the Web Tab of the Project Properties window is only available when working with a Web Project. A Web Project is an Extender. To access the Extenders in a project you would access it with the below code.
Microsoft.VisualStudio.Web.Application.WAProjectExtender extend = null;
foreach ( object item in ( Array )project.ExtenderNames )
{
extend = project.Extender[ item.ToString( ) ] as Microsoft.VisualStudio.Web.Application.WAProjectExtender;
if ( extend != null )
{
return extend.SilverlightDebugging;
}
}
The Class Microsoft.VisualStudio.Web.Application.WAProjectExtender contains all the properties in nicely named easy to access properties. So finding out if SilverlightDebugging is checked is as simple as checking extend.SilverlightDebugging. I wrote an Extension to the Application object that would give me the current project then using that finding the Extender which casts nicely to WAProjectExtender. This class is found inside of the IDE specific assembly located on my system at E:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Microsoft.VisualStudio.Web.Application.dll
精彩评论