AppDomain.SetShadowCopyPath(String) 메서드

정의

경고

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

지정한 디렉터리 경로를 어셈블리가 섀도 복사되는 위치로 설정합니다.Establishes the specified directory path as the location of assemblies to be shadow copied.

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

매개 변수

path
String

각 이름이 세미콜론으로 구분되는 디렉터리 이름 목록입니다.A list of directory names, where each name is separated by a semicolon.

구현

특성

예외

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

예제

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

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

//for evidence Object*
int main()
{
   AppDomainSetup^ setup = gcnew AppDomainSetup;
   
   // Shadow copying will not work unless the application has a name.
   setup->ApplicationName = "MyApplication";
   
   //Create evidence for the new application domain from evidence of
   // current application domain.
   Evidence^ adevidence = AppDomain::CurrentDomain->Evidence;
   
   // Create a new application domain.
   AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence, setup );
   
   // MyAssembly.dll is located in the Assemblies subdirectory.
   domain->AppendPrivatePath( "Assemblies" );
   
   // MyOtherAssembly.dll and MyThirdAssembly.dll are located in the
   // MoreAssemblies subdirectory.
   domain->AppendPrivatePath( "MoreAssemblies" );
   
   // Display the relative search path.
   Console::WriteLine( "RelativeSearchPath: {0}", domain->RelativeSearchPath );
   
   // Because Load returns an Assembly Object*, the assemblies must be
   // loaded into the current domain as well. This will fail unless the
   // current domain also has these directories in its search path.
   AppDomain::CurrentDomain->AppendPrivatePath( "Assemblies" );
   AppDomain::CurrentDomain->AppendPrivatePath( "MoreAssemblies" );
   
   // Save shadow copies to C:\Cache
   domain->SetCachePath( "C:\\Cache" );
   
   // Shadow copy only the assemblies in the Assemblies directory.
   domain->SetShadowCopyPath( String::Concat( domain->BaseDirectory, "Assemblies" ) );
   
   // Turn shadow copying on.
   domain->SetShadowCopyFiles();
   
   // This will be copied.
   // You must supply a valid fully qualified assembly name here.
   domain->Load( "Assembly1 text name, Version, Culture, PublicKeyToken" );
   
   // This will not be copied.
   // You must supply a valid fully qualified assembly name here.
   domain->Load( "Assembly2 text name, Version, Culture, PublicKeyToken" );
   
   // When the shadow copy path is cleared, the CLR will make shadow copies
   // of all private assemblies.
   domain->ClearShadowCopyPath();
   
   // MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time.
   // You must supply a valid fully qualified assembly name here.
   domain->Load( "Assembly3 text name, Version, Culture, PublicKeyToken" );
   
   // Unload the domain.
   AppDomain::Unload( domain );
}

using System;
using System.Security.Policy;
namespace AppDomainSnippets
{
    class ADShadowCopy
    {
        static void Main(string[] args)
        {

            AppDomainSetup setup = new AppDomainSetup();
            // Shadow copying will not work unless the application has a name.
            setup.ApplicationName = "MyApplication";

            //Create evidence for the new application domain from evidence of
            // current application domain.
            Evidence adevidence = AppDomain.CurrentDomain.Evidence;
            
            // Create a new application domain.
            AppDomain domain = AppDomain.CreateDomain("MyDomain", adevidence, setup);
            
            // MyAssembly.dll is located in the Assemblies subdirectory.
            domain.AppendPrivatePath("Assemblies");
            // MyOtherAssembly.dll and MyThirdAssembly.dll are located in the
            // MoreAssemblies subdirectory.
            domain.AppendPrivatePath("MoreAssemblies");
            // Display the relative search path.
            Console.WriteLine("RelativeSearchPath: " + domain.RelativeSearchPath);
            // Because Load returns an Assembly object, the assemblies must be
            // loaded into the current domain as well. This will fail unless the
            // current domain also has these directories in its search path.
            AppDomain.CurrentDomain.AppendPrivatePath("Assemblies");
            AppDomain.CurrentDomain.AppendPrivatePath("MoreAssemblies");
            
            // Save shadow copies to C:\Cache
            domain.SetCachePath("C:\\Cache");
            // Shadow copy only the assemblies in the Assemblies directory.
            domain.SetShadowCopyPath(domain.BaseDirectory + "Assemblies");
            // Turn shadow copying on.
            domain.SetShadowCopyFiles();
            
            // This will be copied.
            // You must supply a valid fully qualified assembly name here. 
            domain.Load("Assembly1 text name, Version, Culture, PublicKeyToken");
            // This will not be copied.
            // You must supply a valid fully qualified assembly name here. 
            domain.Load("Assembly2 text name, Version, Culture, PublicKeyToken");
            
            // When the shadow copy path is cleared, the CLR will make shadow copies
            // of all private assemblies.
            domain.ClearShadowCopyPath();
            // MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time.
            // You must supply a valid fully qualified assembly name here.
            domain.Load("Assembly3 text name, Version, Culture, PublicKeyToken");
            
            // Unload the domain.
            AppDomain.Unload(domain);
        }
    }
}
Imports System.Security.Policy
 'for evidence object

Class ADShadowCopy
   
   'Entry point which delegates to C-style main Private Function
   ' Public Overloads Shared Sub Main()
    '  Main(System.Environment.GetCommandLineArgs())
   ' End Sub
   
   Public Overloads Shared Sub Main(args() As String)
      
      Dim setup As New AppDomainSetup()
      ' Shadow copying will not work unless the application has a name.
      setup.ApplicationName = "MyApplication"
      
      'Create evidence for the new application domain from evidence of
      ' current application domain.
      Dim adevidence As Evidence = AppDomain.CurrentDomain.Evidence
      
      ' Create a new application domain.
      Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", adevidence, setup)
      
      ' MyAssembly.dll is located in the Assemblies subdirectory.
      domain.AppendPrivatePath("Assemblies")
      ' MyOtherAssembly.dll and MyThirdAssembly.dll are located in the
      ' MoreAssemblies subdirectory.
      domain.AppendPrivatePath("MoreAssemblies")
      ' Display the relative search path.
      Console.WriteLine(("RelativeSearchPath: " + domain.RelativeSearchPath))
      ' Because Load returns an Assembly object, the assemblies must be
      ' loaded into the current domain as well. This will fail unless the
      ' current domain also has these directories in its search path.
      AppDomain.CurrentDomain.AppendPrivatePath("Assemblies")
      AppDomain.CurrentDomain.AppendPrivatePath("MoreAssemblies")
      
      ' Save shadow copies to C:\Cache
      domain.SetCachePath("C:\Cache")
      ' Shadow copy only the assemblies in the Assemblies directory.
      domain.SetShadowCopyPath((domain.BaseDirectory + "Assemblies"))
      ' Turn shadow copying on.
      domain.SetShadowCopyFiles()
      
      ' This will be copied.
      ' You must supply a valid fully qualified assembly name here. 
      domain.Load("Assembly1 text name, Version, Culture, PublicKeyToken")
      ' This will not be copied.
      ' You must supply a valid fully qualified assembly name here. 
      domain.Load("Assembly2 text name, Version, Culture, PublicKeyToken")
      
      ' When the shadow copy path is cleared, the CLR will make shadow copies
      ' of all private assemblies.
      domain.ClearShadowCopyPath()
      ' MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time.
      ' You must supply a valid fully qualified assembly name here.
      domain.Load("Assembly3 text name, Version, Culture, PublicKeyToken")
      
      ' Unload the domain.
      AppDomain.Unload(domain)
   End Sub
End Class

설명

기본적으로 섀도 복사본에는 검색을 통해 찾은 모든 어셈블리가 포함 됩니다.By default, a shadow copy includes all assemblies found through probing. SetShadowCopyPath 메서드는 path에 지정 된 디렉터리에 있는 어셈블리에 대 한 섀도 복사본을 제한 합니다.The SetShadowCopyPath method restricts the shadow copy to the assemblies in the directories specified by path.

SetShadowCopyPath 메서드는 어셈블리를 검색할 추가 디렉터리를 지정 하지 않습니다.The SetShadowCopyPath method does not specify additional directories to be searched for assemblies. 섀도 복사할 어셈블리는 이미 검색 경로에 있어야 합니다 (예: BaseDirectory).Assemblies to be shadow-copied must already be located in the search path, for example under BaseDirectory. SetShadowCopyPath 메서드는 섀도 복사할 수 있는 검색 경로를 지정 합니다.The SetShadowCopyPath method specifies which search paths are eligible to be shadow-copied.

이 메서드는이 인스턴스와 연결 된 내부 AppDomainSetupShadowCopyDirectories 속성을 설정 합니다.This method sets the ShadowCopyDirectories property of the internal AppDomainSetup associated with this instance.

섀도 복사에 대 한 자세한 내용은 어셈블리 섀도 복사를 참조 하세요.For more information on shadow copying, see Shadow Copying Assemblies.

보안

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

적용 대상

추가 정보