// DllTestServer.cs
// build with the following command line switches
// csc /t:library DllTestServer.cs
public class DllTestServer
{
public static void Foo()
{
System.Console.WriteLine("DllTestServer.Foo (DllTestServer.DLL)");
}
}
//////////////////////////////////////////////////////////
// DllTestClient.cs
// build with the following command line switches
// csc DllTestClientApp.cs /r:DllTestServer.dll
using System;
using System.Diagnostics;
using System.Reflection;
class DllTestClientApp
{
public static void Main()
{
Assembly DLLAssembly = Assembly.GetAssembly(typeof(DllTestServer));
Console.WriteLine("\nDllTestServer.dll Assembly Information");
Console.WriteLine("\t" + DLLAssembly);
Process p = Process.GetCurrentProcess();
string AssemblyName = p.ProcessName + ".exe";
Assembly ThisAssembly = Assembly.LoadFrom(AssemblyName);
Console.WriteLine("DllTestClient.exe Assembly Information");
Console.WriteLine("\t" + ThisAssembly + "\n");
Console.WriteLine("Calling DllTestServer.Foo...");
DllTestServer.Foo();
}
}