AppDomain.AppendPrivatePath-Methode

HINWEIS: Diese Methode ist mittlerweile veraltet.

Fügt den angegebenen Verzeichnisnamen an den privaten Pfad an.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax

'Declaration
<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 _
)
'Usage
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
)

Parameter

  • path
    Der Name des Verzeichnisses, das an den privaten Pfad angefügt werden soll.

Ausnahmen

Ausnahmetyp Bedingung

AppDomainUnloadedException

Es wird versucht, die Operationen für eine entladene Anwendungsdomäne auszuführen.

Hinweise

Der private Pfad oder relative Suchpfad ist der Pfad relativ zum Basisverzeichnis, in dem der Assemblyresolver nach privaten Assemblys sucht.

Beispiel

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

Plattformen

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 unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 1.0, 1.1
Veraltet (Compilerwarnung) in 2.0

Siehe auch

Referenz

AppDomain-Klasse
AppDomain-Member
System-Namespace