2011-04-18 125 views
0

我正在编写一个可以在调试器启动时激活的Visual Studio插件。加载项需要检查当前正在运行的项目的项目设置,并特别阅读该选项卡底部的Web选项卡上指出调试器的复选框。我想每次阅读项目设置并确定每次调试器启动“ASP.NET”“本机代码”“SQL Server”“Silverlight”“启用编辑并继续”复选框时检查哪些复选框。从Visual Studio 2010加载项读取当前项目设置?

我已经通过SDK中的例子没有发现任何具体读取项目设置。如果有人能指出我的方向是有益的。

回答

1

事实证明,答案比我想象的要容易。 “项目属性”窗口的“Web”选项卡中的“Web配置”仅在使用Web项目时可用。 Web项目是一个扩展。要访问项目中的Extender,您可以使用下面的代码访问它。

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; 
    } 
} 

的Class Microsoft.VisualStudio.Web.Application.WAProjectExtender包含所有属性的命名很好易于访问的性能。因此,查明SilverlightDebugging是否被选中,就像检查extend.SilverlightDebugging一样简单。我为应用程序对象编写了一个扩展,它将给我当前的项目,然后使用该扩展器来很好地转换到WAProjectExtender。该类位于我的系统上位于E:\ Program Files(x86)\ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ Microsoft.VisualStudio.Web.Application.dll的IDE特定程序集内部,位于