Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

AppDomain.ExecuteAssembly Method

Executes the assembly contained in the specified file.

Overload List

Executes the assembly contained in the specified file.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Function ExecuteAssembly(String) As Integer Implements _AppDomain.ExecuteAssembly
[C#] public virtual int ExecuteAssembly(string);
[C++] public: virtual int ExecuteAssembly(String*);
[JScript] public function ExecuteAssembly(String) : int;

Executes the assembly contained in the specified file, using the specified evidence.

[Visual Basic] Overloads Public Overridable Function ExecuteAssembly(String, Evidence) As Integer Implements _AppDomain.ExecuteAssembly
[C#] public virtual int ExecuteAssembly(string, Evidence);
[C++] public: virtual int ExecuteAssembly(String*, Evidence*);
[JScript] public function ExecuteAssembly(String, Evidence) : int;

Executes the assembly contained in the specified file, using the specified evidence and arguments.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Overridable Function ExecuteAssembly(String, Evidence, String()) As Integer Implements _AppDomain.ExecuteAssembly
[C#] public virtual int ExecuteAssembly(string, Evidence, string[]);
[C++] public: virtual int ExecuteAssembly(String*, Evidence*, String*[]);
[JScript] public function ExecuteAssembly(String, Evidence, String[]) : int;

Executes the assembly contained in the specified file, using the specified evidence and arguments.

[Visual Basic] Overloads Public Function ExecuteAssembly(String, Evidence, String(), Byte(), AssemblyHashAlgorithm) As Integer
[C#] public int ExecuteAssembly(string, Evidence, string[], byte[], AssemblyHashAlgorithm);
[C++] public: int ExecuteAssembly(String*, Evidence*, String*[], unsigned char __gc[], AssemblyHashAlgorithm);
[JScript] public function ExecuteAssembly(String, Evidence, String[], Byte[], AssemblyHashAlgorithm) : int;

Example

[Visual Basic, C#, C++] The following sample demonstrates using one of the overloads of ExecuteAssembly on two different domains.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of ExecuteAssembly. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Module Test

   Sub Main()
      Dim currentDomain As AppDomain = AppDomain.CurrentDomain
      Dim otherDomain As AppDomain = AppDomain.CreateDomain("otherDomain")
      
      currentDomain.ExecuteAssembly("MyExecutable.exe")
      ' Prints "MyExecutable running on [default]"

      otherDomain.ExecuteAssembly("MyExecutable.exe")
      ' Prints "MyExecutable running on otherDomain"
   End Sub 'Main

End Module 'Test

[C#] 
class Test {
   public static void Main() {
      AppDomain currentDomain = AppDomain.CurrentDomain;
      AppDomain otherDomain = AppDomain.CreateDomain("otherDomain");
      
      currentDomain.ExecuteAssembly("MyExecutable.exe");
      // Prints "MyExecutable running on [default]"

      otherDomain.ExecuteAssembly("MyExecutable.exe");
      // Prints "MyExecutable running on otherDomain"
   }
}

[C++] 
int main() {
   AppDomain* currentDomain = AppDomain::CurrentDomain;
   AppDomain* otherDomain = AppDomain::CreateDomain(S"otherDomain");

   currentDomain->ExecuteAssembly(S"MyExecutable.exe");
   // Prints S"MyExecutable running on [default]"

   otherDomain->ExecuteAssembly(S"MyExecutable.exe");
   // Prints S"MyExecutable running on otherDomain"
}

[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.

See Also

AppDomain Class | AppDomain Members | System Namespace

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft