ConfigurationManager.ActiveConfiguration 属性

获取将在发生解决方案生成操作时使用的当前解决方案配置。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

声明
ReadOnly Property ActiveConfiguration As Configuration
Configuration ActiveConfiguration { get; }
property Configuration^ ActiveConfiguration {
    Configuration^ get ();
}
abstract ActiveConfiguration : Configuration with get
function get ActiveConfiguration () : Configuration

属性值

类型:EnvDTE.Configuration
一个 Configuration 对象。

备注

使用 Activate 方法可更改活动解决方案配置。

示例

public void CodeExample(DTE2 dte, AddIn addin)
{   // Make sure you have a solution loaded into Visual Studio
    // before running the following example.
    try
    {
        ConfigurationManager configmgr;
        Configuration config;
        if (dte.Solution.Projects.Count > 0)
        {
            configmgr = dte.Solution.Projects.Item(1).ConfigurationManager;
            // Return the ActiveConfiguration.
            config = configmgr.ActiveConfiguration;
            // Show how many Configuration objects are in the Configuration Manager.
            MessageBox.Show(configmgr.Count.ToString());
            // Show the name of the application containing this Configuration Manager.
            MessageBox.Show(configmgr.DTE.Name);
            // Show the parent object.
            MessageBox.Show(((Project)configmgr.Parent).Name);
        }
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

.NET Framework 安全性

请参阅

参考

ConfigurationManager 接口

EnvDTE 命名空间