다음을 통해 공유


AppDomain.AppendPrivatePath 메서드

참고: 이 메서드는 이제 사용되지 않습니다.

지정한 디렉터리 이름을 전용 경로에 추가합니다.

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

구문

‘선언
<ObsoleteAttribute("AppDomain.AppendPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. https://go.microsoft.com/fwlink/?linkid=14202")> _
Public Sub AppendPrivatePath ( _
    path As String _
)
‘사용 방법
Dim instance As AppDomain
Dim path As String

instance.AppendPrivatePath(path)
[ObsoleteAttribute("AppDomain.AppendPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. https://go.microsoft.com/fwlink/?linkid=14202")] 
public void AppendPrivatePath (
    string path
)
[ObsoleteAttribute(L"AppDomain.AppendPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. https://go.microsoft.com/fwlink/?linkid=14202")] 
public:
virtual void AppendPrivatePath (
    String^ path
) sealed
/** @attribute ObsoleteAttribute("AppDomain.AppendPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. https://go.microsoft.com/fwlink/?linkid=14202") */ 
public final void AppendPrivatePath (
    String path
)
ObsoleteAttribute("AppDomain.AppendPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. https://go.microsoft.com/fwlink/?linkid=14202") 
public final function AppendPrivatePath (
    path : String
)

매개 변수

  • path
    전용 경로에 추가되는 디렉터리 이름입니다.

예외

예외 형식 조건

AppDomainUnloadedException

언로드된 응용 프로그램 도메인에서 작업을 시도한 경우

설명

전용 경로 또는 상대 검색 경로는 어셈블리 확인기에서 전용 어셈블리를 조사할 기본 디렉터리에 대한 상대 경로입니다.

예제

Imports System
Imports System.Reflection
Imports System.Security.Policy
Imports System.Security.Permissions

Class ADAppendPrivatePath
   <SecurityPermission(SecurityAction.Demand, Flags:=SecurityPermissionFlag.ControlAppDomain), _
    SecurityPermission(SecurityAction.Demand, Flags:=SecurityPermissionFlag.ControlEvidence)> _
   Public Shared Sub Example()

      'Create evidence for the new appdomain.
      Dim adevidence As Evidence = AppDomain.CurrentDomain.Evidence

      'Create a setup object for the new application domain.
      Dim setup As New AppDomainSetup()

      'Append the relative path
      setup.PrivateBinPath = "www.code.microsoft.com"

      Dim domain As AppDomain = _
          AppDomain.CreateDomain("MyDomain", adevidence, setup)
      
      'Display the new relative search path
      Console.WriteLine("Relative search path is: " _
          & domain.RelativeSearchPath)
      
      AppDomain.Unload(domain)

   End Sub

   Public Shared Sub Main()
      Example()
   End Sub 
End Class 
using System;
using System.Reflection;
using System.Security.Policy;
using System.Security.Permissions;

class ADAppendPrivatePath
{
   [SecurityPermission(SecurityAction.Demand, Flags=SecurityPermissionFlag.ControlAppDomain),
    SecurityPermission(SecurityAction.Demand, Flags=SecurityPermissionFlag.ControlEvidence)]
   public static void Example()
   {
      //Create evidence for new appdomain.
      Evidence adevidence = AppDomain.CurrentDomain.Evidence;

      //Create a setup object for the new application domain.
      AppDomainSetup setup = new AppDomainSetup();

      //Append the relative path
      setup.PrivateBinPath = "www.code.microsoft.com";

      AppDomain domain = 
          AppDomain.CreateDomain("MyDomain", adevidence, setup);

      //display the new relative search path
      Console.WriteLine("Relative search path is: " 
         + domain.RelativeSearchPath);
 
      AppDomain.Unload(domain);   
   }
   public static void Main()
   {
      Example();
   }
}
using namespace System;
using namespace System::Reflection;
using namespace System::Security::Policy;
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 );
   AppDomain::Unload( domain );
}
import System.*;
import System.Reflection.*;
import System.Security.Policy.*;
import System.Security.Permissions.*;

class ADAppendPrivatePath
{
    /** @attribute SecurityPermissionAttribute( SecurityAction.Demand, ControlAppDomain = true )
     */
    public static void main(String[] args)
    {
        //Create evidence for new appdomain.
        Evidence adEvidence = AppDomain.get_CurrentDomain().get_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.get_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.get_RelativeSearchPath());
        AppDomain.Unload(domain);
    } //main
} //ADAppendPrivatePat

.NET Framework 보안

플랫폼

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

1.0, 1.1에서 지원
2.0에서 사용되지 않음(컴파일러 경고)

참고 항목

참조

AppDomain 클래스
AppDomain 멤버
System 네임스페이스