다음을 통해 공유


IVsApplicationConfiguration 인터페이스

구성 파일을 사용 하는 경우 사용에 대 한 인터페이스를 제공 합니다.

네임스페이스:  Microsoft.VisualStudio.ManagedInterfaces9
어셈블리:  Microsoft.VisualStudio.ManagedInterfaces.WCF(Microsoft.VisualStudio.ManagedInterfaces.WCF.dll)

구문

‘선언
Public Interface IVsApplicationConfiguration _
    Inherits IDisposable
public interface IVsApplicationConfiguration : IDisposable
public interface class IVsApplicationConfiguration : IDisposable
type IVsApplicationConfiguration =  
    interface 
        interface IDisposable 
    end
public interface IVsApplicationConfiguration extends IDisposable

IVsApplicationConfiguration 형식에서는 다음과 같은 멤버를 노출합니다.

메서드

  이름 설명
Public 메서드 Dispose 관리되지 않는 리소스의 확보, 해제 또는 다시 설정과 관련된 응용 프로그램 정의 작업을 수행합니다. (IDisposable에서 상속됨)
Public 메서드 FileExists 구성 파일이 디스크에 있는지 여부를 나타내는 값을 반환 합니다.
Public 메서드 FilePath 구성 파일의 경로를 반환합니다.
Public 메서드 LoadConfiguration 특정된 계층/수에 대 한 구성을 로드합니다.
Public 메서드 QueryEditConfiguration 구성 파일을 수정할 수 있는지 확인 합니다.

위쪽

이벤트

  이름 설명
Public 이벤트 ConfigurationChanged 프로젝트의 구성이 변경 될 때 발생 합니다.

위쪽

설명

IVsApplicationConfiguration 인터페이스에 대 한 래퍼는 Configuration 개체입니다.

사용 IVsApplicationConfiguration 변경 알림을 제공 하 고 현재 프로젝트에 대 한 모든 구성 파일에 구성 계층 구조에 대 한 소스 코드입니다. 또한 구성 파일이 열려 있을 수 있습니다 다른 편집기 및이 인스턴스 간의 내부 텍스트 버퍼에 변경 사항을 조정 합니다 사용할 수 있습니다.

IVsApplicationConfiguration또한 핸들 알림이 발생 추가, 삭제 및 구성 파일 및 폴더는 지정 된 계층 구조/무효로 itemid의 구성이 발생할 수 있습니다 방식으로 이동 하 여 변경 합니다. 변경 알림 구성에 대해 등록 된 클라이언트에 알립니다.

예제

다음 코드 예제에서는 IVsApplicationConfiguration 인터페이스 구성 파일을 수정 합니다.

/// Make sure that our custom WSDL importer extension is registered in /// the Metadata section of the configuration file for the current 
/// project hierarchy and serviceProvider that gives access to required 
/// services.
private static void EnsureCustomWsdlImporterRegistered
 (IVsHierarchy hierarchy, IServiceProvider serviceProvider)
{
/// The IVsApplicationConfigurationManager service returns a 
/// System.Configuration.Configuration object corresponding to 
/// the given project's app.config or web.config file.
IVsApplicationConfigurationManager cfgMgr = 
 serviceProvider.GetService(typeof(IVsApplicationConfigurationManager))
 as IVsApplicationConfigurationManager;
    // Return the current application's configuration file by using 
    // the IVsApplicationConfiguration APIs. Make sure that the 
    // instance that is returned is disposed of correctly in order 
    // to clean up any event hooks or docdatas.
    using (IVsApplicationConfiguration appCfg = 
 cfgMgr.GetApplicationConfiguration(hierarchy, 
 Microsoft.VisualStudio.VSConstants.VSITEMID_ROOT))
    {
        System.Configuration.Configuration cfg = 
 appCfg.LoadConfiguration();

        // Check the file out from Source Code Control if it 
        // exists.
        appCfg.QueryEditConfiguration();

        /// After a System.Configuration.Configuration object
        /// exists, use the"normal" .NET Framework configuration
        /// APIs to return the sections that you want to modify.
        ServiceModelSectionGroup sg = 
 ServiceModelSectionGroup.GetSectionGroup(cfg);
        Type importerType = typeof(BindingPickerWsdlImportExtension);
        if (!IsWsdlImporterRegistered(sg, importerType))
        {
            // If our custom WSDL importer is not registered, add 
            // it to the application's configuration file.
            sg.Client.Metadata.WsdlImporters.Add(new 
 WsdlImporterElement(importerType));
            cfg.Save();
        }
    }
}

참고 항목

참조

Microsoft.VisualStudio.ManagedInterfaces9 네임스페이스