AppDomainSetup.ApplicationBase AppDomainSetup.ApplicationBase AppDomainSetup.ApplicationBase AppDomainSetup.ApplicationBase Property

Définition

Obtient ou définit le nom du répertoire contenant l'application.Gets or sets the name of the directory containing the application.

public:
 property System::String ^ ApplicationBase { System::String ^ get(); void set(System::String ^ value); };
public string ApplicationBase { get; set; }
member this.ApplicationBase : string with get, set
Public Property ApplicationBase As String

Valeur de propriété

Nom du répertoire de base de l'application.The name of the application base directory.

Implémente

Exemples

L’exemple suivant montre comment utiliser la ApplicationBase propriété pour définir l’emplacement où le chargeur d’assembly commence à détecter les assemblys à charger dans un nouveau domaine d’application.The following example demonstrates how to use the ApplicationBase property to set the location where the assembly loader begins probing for assemblies to load into a new application domain.

Notes

Vous devez vous assurer que le dossier que vous spécifiez existe.You must ensure that the folder you specify exists.

using namespace System;

int main()
{
    AppDomain^ root = AppDomain::CurrentDomain;

    AppDomainSetup^ setup = gcnew AppDomainSetup();
    setup->ApplicationBase = 
        root->SetupInformation->ApplicationBase + "MyAppSubfolder\\";

    AppDomain^ domain = AppDomain::CreateDomain("MyDomain", nullptr, setup);

    Console::WriteLine("Application base of {0}:\r\n\t{1}", 
        root->FriendlyName, root->SetupInformation->ApplicationBase);
    Console::WriteLine("Application base of {0}:\r\n\t{1}", 
        domain->FriendlyName, domain->SetupInformation->ApplicationBase);

    AppDomain::Unload(domain);
}

/* This example produces output similar to the following:

Application base of MyApp.exe:
        C:\Program Files\MyApp\
Application base of MyDomain:
        C:\Program Files\MyApp\MyAppSubfolder\
 */
using System;

class ADSetupInformation
{
    static void Main()
    {
        AppDomain root = AppDomain.CurrentDomain;

        AppDomainSetup setup = new AppDomainSetup();
        setup.ApplicationBase = 
            root.SetupInformation.ApplicationBase + @"MyAppSubfolder\";

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

        Console.WriteLine("Application base of {0}:\r\n\t{1}", 
            root.FriendlyName, root.SetupInformation.ApplicationBase);
        Console.WriteLine("Application base of {0}:\r\n\t{1}", 
            domain.FriendlyName, domain.SetupInformation.ApplicationBase);

        AppDomain.Unload(domain);
    }
}

/* This example produces output similar to the following:

Application base of MyApp.exe:
        C:\Program Files\MyApp\
Application base of MyDomain:
        C:\Program Files\MyApp\MyAppSubfolder\
 */
Class ADSetupInformation

    Shared Sub Main()

        Dim root As AppDomain = AppDomain.CurrentDomain

        Dim setup As New AppDomainSetup()
        setup.ApplicationBase = _
            root.SetupInformation.ApplicationBase & "MyAppSubfolder\"

        Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", Nothing, setup)

        Console.WriteLine("Application base of {0}:" & vbCrLf & vbTab & "{1}", _
            root.FriendlyName, root.SetupInformation.ApplicationBase)
        Console.WriteLine("Application base of {0}:" & vbCrLf & vbTab & "{1}", _
            domain.FriendlyName, domain.SetupInformation.ApplicationBase)

        AppDomain.Unload(domain)
    End Sub
End Class

' This example produces output similar to the following:
'
'Application base of MyApp.exe:
'        C:\Program Files\MyApp\
'Application base of MyDomain:
'        C:\Program Files\MyApp\MyAppSubfolder\

Remarques

Le répertoire de base de l’application est l’emplacement où le gestionnaire d’assembly commence la détection des assemblys.The application base directory is where the assembly manager begins probing for assemblies.

La ApplicationBase propriété peut influencer les autorisations accordées à un domaine d’application.The ApplicationBase property can influence which permissions are granted to an application domain. Par exemple, un domaine d’application provenant de l’ordinateur local reçoit normalement une confiance totale en fonction de son emplacement d’origine.For example, an application domain originating from the local computer normally receives full trust based on its location of origin. Toutefois, si ApplicationBase la propriété AppDomain de est définie sur le nom complet d’un répertoire intranet, le ApplicationBase paramètre restreint les autorisations accordées au domaine d’application à une attribution LocalIntranet, même si le domaine d’application provient en fait de l’ordinateur local.However, if the ApplicationBase property of that AppDomain is set to the full name of an intranet directory, the ApplicationBase setting restricts the permissions granted to the application domain to a LocalIntranet grant even though the application domain actually originates from the local computer.

Sécurité

FileIOPermission
pour accéder aux informations de chemin d’accès.for access to the path information. Énumération associée:PathDiscoveryAssociated enumeration: PathDiscovery

S’applique à