ConfigurationManager.ActiveConfiguration 属性

定义

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

public:
 property EnvDTE::Configuration ^ ActiveConfiguration { EnvDTE::Configuration ^ get(); };
public:
 property EnvDTE::Configuration ^ ActiveConfiguration { EnvDTE::Configuration ^ get(); };
[System.Runtime.InteropServices.DispId(13)]
public EnvDTE.Configuration ActiveConfiguration { [System.Runtime.InteropServices.DispId(13)] get; }
[<System.Runtime.InteropServices.DispId(13)>]
[<get: System.Runtime.InteropServices.DispId(13)>]
member this.ActiveConfiguration : EnvDTE.Configuration
Public ReadOnly Property ActiveConfiguration As Configuration

属性值

Configuration

Configuration 对象。

属性

示例

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

注解

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

适用于