다음을 통해 공유


SolutionConfiguration2.Delete 메서드

컬렉션에서 SolutionConfiguration 개체를 제거합니다.

네임스페이스:  EnvDTE80
어셈블리:  EnvDTE80(EnvDTE80.dll)

구문

‘선언
Sub Delete
void Delete()
void Delete()
abstract Delete : unit -> unit 
function Delete()

구현

SolutionConfiguration.Delete()

설명

SolutionConfiguration 개체에서는 마지막에 남는 솔루션 구성을 삭제할 수 없습니다.

예제

이 예제에서는 첫 번째 항목에 대한 활성 솔루션 구성 항목의 이름을 표시한 다음 이를 활성화한 후 삭제합니다. 이 추가 기능을 실행하기 전에 Visual Studio IDE(통합 개발 환경)에서 프로젝트를 엽니다. 이 예제를 실행한 후에는 첫 번째 메시지 상자에 표시되던 구성 항목이 솔루션 구성 드롭다운 메뉴에서 제거됩니다.

이 예제를 추가 기능으로 실행하는 방법에 대한 자세한 내용은 방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행을 참조하십시오.

Imports EnvDTE
Imports EnvDTE80
Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    SolutionConfigurationDeleteExample(_applicationObject)
End Sub
Sub SolutionConfigurationDeleteExample(ByVal dte As DTE2)
    ' Open a solution in the Visual Studio IDE
    ' before running this example.
    Try
        Dim builder As SolutionBuild = _
        _applicationObject.Solution.SolutionBuild
        Dim config As SolutionConfiguration2
        config = CType(builder.SolutionConfigurations.Item(1), _
        SolutionConfiguration2)
        MsgBox("The first solution configuration item's name in _
         the collection is: " & config.Collection.Item(1).Name)
        MsgBox("Activating the solution configuration...")
        config.Activate()
        MsgBox("Deleting the solution configuration...")
        config.Delete()
    Catch ex As System.Exception
        MsgBox(ex.ToString)
    End Try
End Sub
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void OnConnection(object application, 
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    SolutionConfigurationDeleteExample(_applicationObject);
}
public void SolutionConfigurationDeleteExample(DTE2 dte)
{
    try
    {
        SolutionBuild builder =
 _applicationObject.Solution.SolutionBuild;
        SolutionConfiguration2 config;
        config =
 (SolutionConfiguration2)builder.SolutionConfigurations.Item(1);
        MessageBox.Show("The platform name of the 
solution configuration is: " + config.PlatformName);
        MessageBox.Show("Activating the solution configuration...");
        config.Activate();
        MessageBox.Show("Deleting the solution configuration...");
        config.Delete();
    }
    catch(SystemException ex)
    {
        MessageBox.Show(ex.ToString());
    }
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

SolutionConfiguration2 인터페이스

Delete 오버로드

EnvDTE80 네임스페이스