AppDomainSetup::ApplicationBase Property
Gets or sets the name of the directory containing the application.
Assembly: mscorlib (in mscorlib.dll)
public: virtual property String^ ApplicationBase { String^ get () sealed; void set (String^ value) sealed; }
Implements
IAppDomainSetup::ApplicationBaseThe application base directory is where the assembly manager begins probing for assemblies.
The ApplicationBase property can influence which permissions are granted to an application domain. For example, an application domain originating from the local computer normally receives full trust based on its location of origin. 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.
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.
Note |
|---|
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\ */
- FileIOPermission
for access to the path information. Associated enumeration: FileIOPermissionAccess::PathDiscovery
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note