AppDomain.CreateDomain Method (String, Evidence, String, String, Boolean, AppDomainInitializer, String[])

Note: This method is new in the .NET Framework version 2.0.

Creates a new application domain with the given name, using evidence, application base path, relative search path, and a parameter that specifies whether a shadow copy of an assembly is to be loaded into the application domain. Specifies a callback method that is invoked when the application domain is initialized, and an array of string arguments to pass the callback method.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Public Shared Function CreateDomain ( _
	friendlyName As String, _
	securityInfo As Evidence, _
	appBasePath As String, _
	appRelativeSearchPath As String, _
	shadowCopyFiles As Boolean, _
	adInit As AppDomainInitializer, _
	adInitArgs As String() _
) As AppDomain
Dim friendlyName As String
Dim securityInfo As Evidence
Dim appBasePath As String
Dim appRelativeSearchPath As String
Dim shadowCopyFiles As Boolean
Dim adInit As AppDomainInitializer
Dim adInitArgs As String()
Dim returnValue As AppDomain

returnValue = AppDomain.CreateDomain(friendlyName, securityInfo, appBasePath, appRelativeSearchPath, shadowCopyFiles, adInit, adInitArgs)
public static AppDomain CreateDomain (
	String friendlyName, 
	Evidence securityInfo, 
	String appBasePath, 
	String appRelativeSearchPath, 
	boolean shadowCopyFiles, 
	AppDomainInitializer adInit, 
	String[] adInitArgs
public static function CreateDomain (
	friendlyName : String, 
	securityInfo : Evidence, 
	appBasePath : String, 
	appRelativeSearchPath : String, 
	shadowCopyFiles : boolean, 
	adInit : AppDomainInitializer, 
	adInitArgs : String[]
) : AppDomain



The friendly name of the domain. This friendly name can be displayed in user interfaces to identify the domain. For more information, see FriendlyName.


Evidence mapped through the security policy to establish a top-of-stack permission set.


The base directory that the assembly resolver uses to probe for assemblies. For more information, see BaseDirectory.


The path relative to the base directory where the assembly resolver should probe for private assemblies. For more information, see RelativeSearchPath.


true to load a shadow copy of an assembly into the application domain. For more information, see ShadowCopyFiles.


An AppDomainInitializer delegate that represents a callback method to invoke when the new AppDomain object is initialized.


An array of string arguments to be passed to the callback represented by adInit, when the new AppDomain object is initialized.

Return Value

The newly created application domain.

Exception typeCondition


friendlyName is a null reference (Nothing in Visual Basic).

The method represented by adInit is executed in the context of the newly created application domain.

If securityInfo is not supplied, the evidence from the current application domain is used.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions