AppDomain.BaseDirectory 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
어셈블리 확인자에서 어셈블리를 조사하는 데 사용하는 기본 디렉터리를 가져옵니다.
public:
property System::String ^ BaseDirectory { System::String ^ get(); };
public string BaseDirectory { get; }
public string? BaseDirectory { get; }
member this.BaseDirectory : string
Public ReadOnly Property BaseDirectory As String
속성 값
어셈블리 확인자에서 어셈블리를 조사하는 데 사용하는 기본 디렉터리입니다.
구현
예외
언로드된 애플리케이션 도메인에서 작업이 시도됩니다.
예제
다음 코드 예제는 도메인에 로드 하려면 어셈블리에 대해 검색할 때 사용할 기본 디렉터리를 지정 하는 새 애플리케이션 도메인을 만듭니다. 그런 다음 이 속성을 사용하여 BaseDirectory 콘솔에 표시할 기본 디렉터리 경로를 가져옵니다.
using namespace System;
using namespace System::IO;
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("{0}{1}ADSetup.exe.config",
Environment::CurrentDirectory,
Path::DirectorySeparatorChar);
domaininfo->ApplicationBase = String::Format("{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("Domain2", adevidence, domaininfo);
// Display application domain information
Console::WriteLine("Host domain: {0}", AppDomain::CurrentDomain->FriendlyName);
Console::WriteLine("Child domain: {0}", domain->FriendlyName);
Console::WriteLine();
Console::WriteLine("Configuration file: {0}", domain->SetupInformation->ConfigurationFile);
Console::WriteLine( "Application Base Directory: {0}", domain->BaseDirectory);
AppDomain::Unload(domain);
}
// The example displays output like the following:
// Host domain: adsetup.exe
// Child domain: Domain2
//
// Configuration file: C:\Test\ADSetup.exe.config
// Application Base Directory: C:\Test
using System;
using System.IO;
using System.Reflection;
using System.Security.Policy;
class ADSetup
{
public static void Main()
{
// Create application domain setup information
var domaininfo = new AppDomainSetup();
domaininfo.ConfigurationFile = System.Environment.CurrentDirectory +
Path.DirectorySeparatorChar +
"ADSetup.exe.config";
domaininfo.ApplicationBase = 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("Domain2", adEvidence, domaininfo);
// Display application domain information.
Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName);
Console.WriteLine("Child domain: " + domain.FriendlyName);
Console.WriteLine();
Console.WriteLine("Configuration file: " + domain.SetupInformation.ConfigurationFile);
Console.WriteLine("Application Base Directory: " + domain.BaseDirectory);
AppDomain.Unload(domain);
}
}
// The example displays output like the following:
// Host domain: adsetup.exe
// Child domain: Domain2
//
// Configuration file: C:\Test\ADSetup.exe.config
// Application Base Directory: C:\Test
open System
open System.IO
// Create application domain setup information
let domaininfo = AppDomainSetup()
domaininfo.ConfigurationFile <- Environment.CurrentDirectory + string Path.DirectorySeparatorChar + "ADSetup.exe.config"
domaininfo.ApplicationBase <- Environment.CurrentDirectory
//Create evidence for the new appdomain from evidence of the current application domain
let adEvidence = AppDomain.CurrentDomain.Evidence
// Create appdomain
let domain = AppDomain.CreateDomain("Domain2", adEvidence, domaininfo)
// Display application domain information.
printfn $"Host domain: {AppDomain.CurrentDomain.FriendlyName}"
printfn $"Child domain: {domain.FriendlyName}\n"
printfn $"Configuration file: {domain.SetupInformation.ConfigurationFile}"
printfn $"Application Base Directory: {domain.BaseDirectory}"
AppDomain.Unload domain
// The example displays output like the following:
// Host domain: adsetup.exe
// Child domain: Domain2
//
// Configuration file: C:\Test\ADSetup.exe.config
// Application Base Directory: C:\Test
Imports System.IO
Imports System.Reflection
Imports System.Security.Policy
Module Example
Public Sub Main()
' Create the application domain setup information.
Dim domaininfo As New AppDomainSetup()
domaininfo.ConfigurationFile = Environment.CurrentDirectory +
Path.DirectorySeparatorChar +
"ADSetup.exe.config"
domaininfo.ApplicationBase = 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("Domain2", adevidence, domaininfo)
' Display the application domain information.
Console.WriteLine(("Host domain: " + AppDomain.CurrentDomain.FriendlyName))
Console.WriteLine(("Child domain: " + domain.FriendlyName))
Console.WriteLine()
Console.WriteLine(("Configuration file: " + domain.SetupInformation.ConfigurationFile))
Console.WriteLine(("Application Base Directory: " + domain.BaseDirectory))
AppDomain.Unload(domain)
End Sub
End Module
' The example displays output like the following:
' Host domain: adsetup.exe
' Child domain: Domain2
'
' Configuration file: C:\Test\ADSetup.exe.config
' Application Base Directory: C:\Test
설명
이 속성에 해당 하는 AppDomainSetup.ApplicationBase 속성입니다. "APPBASE" 문자열이 있는 메서드를 GetData 사용하여 검색할 수도 있습니다.