共用方式為


ConfigurationManager.ActiveConfiguration 屬性

取得將於方案建置作業進行時使用的目前方案組態。

命名空間:  EnvDTE
組件:  EnvDTE (在 EnvDTE.dll 中)

語法

'宣告
ReadOnly Property ActiveConfiguration As Configuration
    Get
Configuration ActiveConfiguration { get; }
property Configuration^ ActiveConfiguration {
    Configuration^ get ();
}
abstract ActiveConfiguration : Configuration
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 命名空間