AppDomain.ClearPrivatePath 메서드

정의

경고

이 API는 현재 사용되지 않습니다.

프라이빗 어셈블리의 위치를 지정하는 경로를 빈 문자열("")로 다시 설정합니다.Resets the path that specifies the location of private assemblies to the empty string ("").

public:
 virtual void ClearPrivatePath();
[System.Obsolete("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead.")]
[System.Obsolete("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. https://go.microsoft.com/fwlink/?linkid=14202")]
[System.Security.SecurityCritical]
[System.Obsolete("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. https://go.microsoft.com/fwlink/?linkid=14202")]
public void ClearPrivatePath ();
abstract member ClearPrivatePath : unit -> unit
override this.ClearPrivatePath : unit -> unit
Public Sub ClearPrivatePath ()

구현

특성

예외

언로드된 애플리케이션 도메인에서 작업이 시도됩니다.The operation is attempted on an unloaded application domain.

예제

다음 코드 예제에서는 ClearPrivatePath 메서드를 사용 하 여 어셈블리가 로드 될 때 검색할 개인 경로 목록에서 모든 항목을 제거 하는 방법을 보여 줍니다.The following code example demonstrates how to use the ClearPrivatePath method to remove all entries from the list of private paths to search when assemblies are loaded.

이 메서드는 이제 사용 되지 않으며 새로운 개발에 사용 하지 않아야 합니다.This method is now obsolete, and should not be used for new development.

using namespace System;
using namespace System::Reflection;
using namespace System::Security::Policy;

//for evidence Object
int main()
{
   
   //Create evidence for new appdomain.
   Evidence^ adevidence = AppDomain::CurrentDomain->Evidence;
   
   //Create the new application domain.
   AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence );
   
   //Display the current relative search path.
   Console::WriteLine( "Relative search path is: {0}", domain->RelativeSearchPath );
   
   //Append the relative path.
   String^ Newpath = "www.code.microsoft.com";
   domain->AppendPrivatePath( Newpath );
   
   //Display the new relative search path.
   Console::WriteLine( "Relative search path is: {0}", domain->RelativeSearchPath );
   
   //Clear the private search path.
   domain->ClearPrivatePath();
   
   //Display the new relative search path.
   Console::WriteLine( "Relative search path is now: {0}", domain->RelativeSearchPath );
   AppDomain::Unload( domain );
}

using System;
using System.Reflection;
using System.Security.Policy;

class ADAppendPrivatePath
{
    public static void Main()
    {
        //Create evidence for new appdomain.
        Evidence adevidence = AppDomain.CurrentDomain.Evidence;

        //Create the new application domain.
        AppDomain domain = AppDomain.CreateDomain("MyDomain", adevidence);

        //Display the current relative search path.
        Console.WriteLine("Relative search path is: " + domain.RelativeSearchPath);

        //Append the relative path.
        String Newpath = "www.code.microsoft.com";
        domain.AppendPrivatePath(Newpath);

        //Display the new relative search path.
        Console.WriteLine("Relative search path is: " + domain.RelativeSearchPath);

        //Clear the private search path.
        domain.ClearPrivatePath();

        //Display the new relative search path.
        Console.WriteLine("Relative search path is now: " + domain.RelativeSearchPath);

 
        AppDomain.Unload(domain);	
    }
}
Imports System.Reflection
Imports System.Security.Policy

Class ADAppendPrivatePath
   
   Public Shared Sub Main()
      'Create evidence for new appdomain.
      Dim adevidence As Evidence = AppDomain.CurrentDomain.Evidence
      
      'Create the new application domain.
      Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", adevidence)
      
      'Display the current relative search path.
      Console.WriteLine("Relative search path is: " & domain.RelativeSearchPath)
      
      'Append the relative path.
      Dim Newpath As [String] = "www.code.microsoft.com"
      domain.AppendPrivatePath(Newpath)
      
      'Display the new relative search path.
      Console.WriteLine("Relative search path is: " & domain.RelativeSearchPath)
      
      'Clear the private search path.
      domain.ClearPrivatePath()
      
      'Display the new relative search path.
      Console.WriteLine("Relative search path is now: " & domain.RelativeSearchPath)
      
      
      AppDomain.Unload(domain)
   End Sub
End Class

설명

개인 경로는 공용 언어 런타임에서 전용 어셈블리를 찾기 위해 검색 하는 기본 디렉터리에 대 한 상대 경로입니다.The private path is a path relative to the base directory that the common language runtime searches to locate private assemblies.

자세한 내용은 AppDomainSetup.PrivateBinPath을 참조하세요.For more information, see AppDomainSetup.PrivateBinPath.

보안

SecurityCriticalAttribute
직접 실행 호출자에 대 한 완전 신뢰가 필요 합니다.Requires full trust for the immediate caller. 이 멤버는 부분적으로 신뢰할 수 있는 또는 투명 코드에서 사용할 수 없습니다.This member cannot be used by partially trusted or transparent code.

적용 대상

추가 정보