This documentation is archived and is not being maintained.

AppDomain.CreateDomain Method (String, Evidence, AppDomainSetup)

.NET Framework 1.1

Creates a new application domain using the specified name, evidence, and application domain setup information.

[Visual Basic]
Overloads Public Shared Function CreateDomain( _
   ByVal friendlyName As String, _
   ByVal securityInfo As Evidence, _
   ByVal info As AppDomainSetup _
) As AppDomain
public static AppDomain CreateDomain(
 string friendlyName,
 Evidence securityInfo,
 AppDomainSetup info
public: static AppDomain* CreateDomain(
 String* friendlyName,
 Evidence* securityInfo,
 AppDomainSetup* info
public static function CreateDomain(
   friendlyName : String,
 securityInfo : Evidence,
 info : AppDomainSetup
) : AppDomain;


The friendly name of the domain. This friendly name can be displayed in user interfaces to identify the domain. For more information, see the description of FriendlyName.
Evidence mapped through the security policy to establish a top-of-stack permission set.
An object that contains application domain initialization information.

Return Value

The newly created application domain.


Exception Type Condition
SecurityException The caller does not have the correct permissions. See the requirements section.


[Visual Basic, C#, C++] The following sample demonstrates, in general, how to create a domain using one of the CreateDomain overloads.

[Visual Basic] 
' Set up the AppDomainSetup
Dim setup As New AppDomainSetup()
setup.ApplicationBase = "(some directory)"
setup.ConfigurationFile = "(some file)"

' Set up the Evidence
Dim baseEvidence As Evidence = AppDomain.CurrentDomain.Evidence
Dim evidence As New Evidence(baseEvidence)
evidence.AddAssembly("(some assembly)")
evidence.AddHost("(some host)")

' Create the AppDomain
Dim newDomain As AppDomain = AppDomain.CreateDomain("newDomain", evidence, setup)

// Set up the AppDomainSetup
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase = "(some directory)";
setup.ConfigurationFile = "(some file)";

// Set up the Evidence
Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
Evidence evidence = new Evidence(baseEvidence);
evidence.AddAssembly("(some assembly)");
evidence.AddHost("(some host)");

// Create the AppDomain      
AppDomain newDomain = AppDomain.CreateDomain("newDomain", evidence, setup);

// Set up the AppDomainSetup
AppDomainSetup* setup = new AppDomainSetup();
setup->ApplicationBase = S"(some directory)";
setup->ConfigurationFile = S"(some file)";

// Set up the Evidence
Evidence*  baseEvidence = AppDomain::CurrentDomain->Evidence;
Evidence* evidence = new Evidence(baseEvidence);
evidence->AddAssembly(S"(some assembly)");
evidence->AddHost(S"(some host)");

// Create the AppDomain
AppDomain*  newDomain = AppDomain::CreateDomain(S"newDomain", evidence, setup);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

AppDomain Class | AppDomain Members | System Namespace | AppDomain.CreateDomain Overload List