Microsoft Download Center Archive
ADMHost Sample Application |
Demonstrates how an unmanaged application can host the CLR and use an AppDomainManager to write a portion of the host code in managed code.
This sample demonstrates how to use the managed hosting infrastructure in the .NET Framework 2.0. It is split into two portions, the unmanaged host (ADMHost.exe) and the managed host contained in ManagedHost.dll. The unmanaged host binds to the CLR, and loads it into the process. It then relies on services provided by the managed host to actually perform its work.
The sample itself simply uses the managed host to create a second AppDomain, and echo hello world. However, it can easily be adopted to do more sophisticated things. To modify this code for your own purposes, first replace the ADMHost.snk keypair with your own. When you do this you’ll need to replace the public key token in the AppDomainManagerAssembly constant defined in ClrHost.cpp on line 4. If you change the name of the assembly containing your managed host, or the name of the class derived from AppDomainManager you’ll also need to update the AppDomainManagerAssembly and AppDomainManagerType constants.
You would then define the set of services that the unmanaged host will provide to it’s managed half in the IUmanagedHost interface defined in IUnmanagedHost.cs. These functions would be implemented in the CClrHost class. To provide a set of services to the unmanaged host, first define them in the IManagedHost interface defined in IManagedHost.cs, then implement them on the ManagedHost class.
The actual work of the application occurs in RunApplication, defined in ADMHost.cpp. Currently this function provides basic “hello, world” functionality; however it could easily be replaced with more application specific work.
Files
Status: DeletedThis download is no longer available on microsoft.com. The downloads below are archives provided by the Internet Archive Wayback Machine from the Microsoft Download Center prior to January 2019. |
No files found
File sizes and hashes are retrieved from the Wayback Machine’s indexes. They may not match the latest versions of files hosted on Microsoft servers.
System Requirements
Operating Systems: Windows Server 2003, Windows XP
Visual Studio 2005, Beta 2 or later
CLR 2.0 Beta 2 or later
Installation Instructions
Run the installer to copy the sample to a folder on your local machine. Open the solution file in Visual Studio 2005 (Beta 2 or Later).
FamilyId: c5a01892-e2cc-473b-a042-48ed43687470