AppDomain.SetShadowCopyPath(String) 메서드

정의

주의

AppDomain.SetShadowCopyPath has been deprecated. Please investigate the use of AppDomainSetup.ShadowCopyDirectories instead. https://go.microsoft.com/fwlink/?linkid=14202

주의

AppDomain.SetShadowCopyPath has been deprecated and is not supported.

주의

AppDomain.SetShadowCopyPath has been deprecated. Please investigate the use of AppDomainSetup.ShadowCopyDirectories instead. http://go.microsoft.com/fwlink/?linkid=14202

주의

Use AppDomainSetup.ShadowCopyDirectories

지정한 디렉터리 경로를 어셈블리가 섀도 복사되는 위치로 설정합니다.

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

매개 변수

path
String

각 이름이 세미콜론으로 구분되는 디렉터리 이름 목록입니다.

구현

특성

예외

언로드된 애플리케이션 도메인에서 작업이 시도됩니다.

예제

이 메서드는 이제 사용되지 않으며 새 개발에 사용해서는 안 됩니다.

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);
        }
    }
}
open System

let setup = 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.
let adevidence = AppDomain.CurrentDomain.Evidence

// Create a new application domain.
let 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.
printfn $"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" |> ignore
// This will not be copied.
// You must supply a valid fully qualified assembly name here.
domain.Load "Assembly2 text name, Version, Culture, PublicKeyToken" |> ignore

// 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" |> ignore

// 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

설명

기본적으로 섀도 복사본에는 검색을 통해 찾은 모든 어셈블리가 포함됩니다. 이 메서드는 SetShadowCopyPath 섀도 복사본을 .에서 지정한 디렉터리에 있는 어셈블리로 path제한합니다.

이 메서드는 SetShadowCopyPath 어셈블리를 검색할 추가 디렉터리를 지정하지 않습니다. 섀도 복사할 어셈블리는 검색 경로(예: 아래 BaseDirectory)에 이미 있어야 합니다. 이 메서드는 SetShadowCopyPath 섀도 복사할 수 있는 검색 경로를 지정합니다.

이 메서드는 ShadowCopyDirectories 이 인스턴스와 연결된 내부 AppDomainSetup 속성을 설정합니다.

섀도 복사에 대한 자세한 내용은 섀도 복사 어셈블리를 참조하세요.

적용 대상

추가 정보