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

Definición

Obtiene o establece el nombre del directorio que contiene la aplicación.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

Valor de propiedad

El nombre del directorio base de la aplicación.The name of the application base directory.

Implementaciones

Ejemplos

En el ejemplo siguiente se muestra cómo utilizar ApplicationBase la propiedad para establecer la ubicación donde el cargador de ensamblados comienza a buscar los ensamblados que se van a cargar en un nuevo dominio de aplicación.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.

Nota

Debe asegurarse de que la carpeta especificada 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\

Comentarios

El directorio base de la aplicación es donde el administrador de ensamblados comienza a buscar ensamblados.The application base directory is where the assembly manager begins probing for assemblies.

La ApplicationBase propiedad puede influir en los permisos que se conceden a un dominio de aplicación.The ApplicationBase property can influence which permissions are granted to an application domain. Por ejemplo, un dominio de aplicación que se origina en el equipo local recibe normalmente plena confianza en función de su ubicación de origen.For example, an application domain originating from the local computer normally receives full trust based on its location of origin. Sin embargo, si ApplicationBase la propiedad AppDomain de se establece en el nombre completo de un directorio de la intranet ApplicationBase , el valor restringe los permisos concedidos al dominio de aplicación a una concesión LocalIntranet, aunque el dominio de aplicación realmente se origina desde el equipo 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.

Seguridad

FileIOPermission
para acceder a la información de la ruta de acceso.for access to the path information. Enumeración asociada:PathDiscoveryAssociated enumeration: PathDiscovery

Se aplica a