AppDomain.BaseDirectory-Eigenschaft
Ruft das Basisverzeichnis ab, das der Assemblyresolver zur Suche nach Assemblys verwendet hat.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public ReadOnly Property BaseDirectory As String
'Usage
Dim instance As AppDomain
Dim value As String
value = instance.BaseDirectory
public string BaseDirectory { get; }
public:
virtual property String^ BaseDirectory {
String^ get () sealed;
}
/** @property */
public final String get_BaseDirectory ()
public final function get BaseDirectory () : String
Eigenschaftenwert
Das Basisverzeichnis, das der Assemblyresolver zur Suche nach Assemblys verwendet.
Ausnahmen
Ausnahmetyp | Bedingung |
---|---|
Es wird versucht, die Operationen für eine entladene Anwendungsdomäne auszuführen. |
Hinweise
Diese Eigenschaft entspricht der APPBASE des Assemblyresolvers.
Beispiel
Imports System
Imports System.Reflection
Imports System.Security.Policy
'for evidence object
Class ADSetup
Public Shared Sub Main()
' Create the application domain setup information.
Dim domaininfo As New AppDomainSetup()
domaininfo.ConfigurationFile = "file:///" + System.Environment.CurrentDirectory + "ADSetup.exe.config"
domaininfo.ApplicationBase = "file:///" + System.Environment.CurrentDirectory
'Create evidence for the new appdomain from evidence of the current application domain.
Dim adevidence As Evidence = AppDomain.CurrentDomain.Evidence
' Create appdomain.
Dim domain As AppDomain = AppDomain.CreateDomain("MyDomain", adevidence, domaininfo)
' Write out the application domain information.
Console.WriteLine(("Host domain: " + AppDomain.CurrentDomain.FriendlyName))
Console.WriteLine(("child domain: " + domain.FriendlyName))
Console.WriteLine()
Console.WriteLine(("Configuration file is: " + domain.SetupInformation.ConfigurationFile))
Console.WriteLine(("Application Base Directory is: " + domain.BaseDirectory))
AppDomain.Unload(domain)
End Sub 'Main
End Class 'ADSetup
using System;
using System.Reflection;
using System.Security.Policy; //for evidence object
class ADSetup
{
public static void Main()
{
// Create application domain setup information
AppDomainSetup domaininfo = new AppDomainSetup();
domaininfo.ConfigurationFile = "file:///" + System.Environment.CurrentDirectory + "ADSetup.exe.config";
domaininfo.ApplicationBase = "file:///" + System.Environment.CurrentDirectory;
//Create evidence for the new appdomain from evidence of the current application domain
Evidence adevidence = AppDomain.CurrentDomain.Evidence;
// Create appdomain
AppDomain domain = AppDomain.CreateDomain("MyDomain", adevidence, domaininfo);
// Write out application domain information
Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName);
Console.WriteLine("child domain: " + domain.FriendlyName);
Console.WriteLine();
Console.WriteLine("Configuration file is: " + domain.SetupInformation.ConfigurationFile);
Console.WriteLine("Application Base Directory is: " + domain.BaseDirectory);
AppDomain.Unload(domain);
}
}
using namespace System;
using namespace System::Reflection;
using namespace System::Security::Policy;
//for evidence Object
int main()
{
// Create application domain setup information
AppDomainSetup^ domaininfo = gcnew AppDomainSetup;
domaininfo->ConfigurationFile = String::Format( "file:///{0}ADSetup.exe.config", System::Environment::CurrentDirectory );
domaininfo->ApplicationBase = String::Format( "file:///{0}", System::Environment::CurrentDirectory );
//Create evidence for the new appdomain from evidence of the current application domain
Evidence^ adevidence = AppDomain::CurrentDomain->Evidence;
// Create appdomain
AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence, domaininfo );
// Write out application domain information
Console::WriteLine( "Host domain: {0}", AppDomain::CurrentDomain->FriendlyName );
Console::WriteLine( "child domain: {0}", domain->FriendlyName );
Console::WriteLine();
Console::WriteLine( "Configuration file is: {0}", domain->SetupInformation->ConfigurationFile );
Console::WriteLine( "Application Base Directory is: {0}", domain->BaseDirectory );
AppDomain::Unload( domain );
}
import System.*;
import System.Reflection.*;
import System.Security.Policy.*; //for evidence object
class ADSetup
{
public static void main(String[] args)
{
// Create application domain setup information
AppDomainSetup domainInfo = new AppDomainSetup();
domainInfo.set_ConfigurationFile("file:///"
+ System.Environment.get_CurrentDirectory() + "ADSetup.exe.config");
domainInfo.set_ApplicationBase("file:///"
+ System.Environment.get_CurrentDirectory());
// Create evidence for the new appdomain from evidence of the
// current application domain
Evidence adEvidence = AppDomain.get_CurrentDomain().get_Evidence();
// Create appdomain
AppDomain domain = AppDomain.CreateDomain("MyDomain", adEvidence,
domainInfo);
// Write out application domain information
Console.WriteLine("Host domain: "
+ AppDomain.get_CurrentDomain().get_FriendlyName());
Console.WriteLine("child domain: "
+ domain.get_FriendlyName());
Console.WriteLine();
Console.WriteLine("Configuration file is: "
+ domain.get_SetupInformation().get_ConfigurationFile());
Console.WriteLine("Application Base Directory is: "
+ domain.get_BaseDirectory());
AppDomain.Unload(domain);
} //main
} //ADSetup
.NET Framework-Sicherheit
- FileIOPermission für den Lesezugriff auf eine Datei oder ein Verzeichnis und für den Zugriff auf Informationen im Pfad selbst, sofern der Pfad in der Form "file://", \\UNC\Verzeichnis oder "c:\" angegeben ist. Zugeordnete Enumerationen: FileIOPermissionAccess.Read, FileIOPermissionAccess.PathDiscovery.
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, 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: 2.0, 1.1, 1.0