During the installation of Manifest Maker you have an option to install examples:
The 'Examples' folder is inside your Manifest maker installation folder. Default location is "C:\Program Files\Maze Computer\Manifest Maker\Examples". Below is the summary of all available examples by folder. All examples are built and tested with the latest version of Visual Studio.
This example illustrates the use of Activation Context API. Additionally ActCtx_cpp project allows experimentetion with the relative locations of manifest and program. For example program is in "C:\Program Files\Example\program.exe" and manifest with assembly are in "C:\ProgramData\AssemblyLibrary\Assembly01". Read source comments for more information.
Complete examples of isolating ASP .Net applications described at: http://www.mazecomputer.com/sxs/help/iis_aspnet.htm and http://www.mazecomputer.com/sxs/help/iis_aspnetxmp.htm
- _amd64, _x86
- Prebuilt manifests and assemblies for 64-bit and 32-bit examples.
- Visual Studio project for the Activation Context helper class.
- Example which sets default, process wide, activation context. This example requires that the host program not have a built-in manifest. As of May 2016 this excludes IIS Express and Visual Studio WebDev.WebServer40.exe versions 10 and 11. IIS Express has an external manifest and it does not work without it. The WebDev server has an embedded manifest. This example works with Windows 2012 R2 server's IIS. Read note about Windows Server 2008 R2 and Windows 7.
- Example of an inline ASP .Net application which explicitly loads and activates an Activation Context in each transaction. This example works in all configurations.
- Example of code-behind ASP .Net application which explicitly loads and activates an Activation Context in each transaction. This example works in all configurations.
Example execution of IISExpress with ProgramManifest project
The GET request below is the first page display, the POST is the button click.
D:\Data\Examples\a\b\c>"C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:"D:\Data\Examples\a\b\aspnet20sample\ProgramManifest" /port:8080 Copied template config file 'C:\Program Files (x86)\IIS Express\AppServer\applicationhost.config' to 'C:\Users\User\AppData\Local\Temp\iisexpress\applicationhost2016511361652.config' Updated configuration file 'C:\Users\User\AppData\Local\Temp\iisexpress\applicationhost2016511361652.config' with given cmd line info. Starting IIS Express ... Successfully registered URL "http://localhost:8080/" for site "Development Web Site" application "/" Registration completed IIS Express is running. Enter 'Q' to stop IIS Express Request started: "GET" http://localhost:8080/ Request ended: http://localhost:8080/default.aspx with HTTP status 200.0 Request started: "POST" http://localhost:8080/ Request ended: http://localhost:8080/default.aspx with HTTP status 200.0 Stopping IIS Express ... IIS Express stopped.
Example execution of IISExpress with InlineCSManifest project
The GET request below is the first and only page display.
D:\Data\Temp\Examples\a\b\aspnet20sample>"C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:"D:\Data\Temp\Examples\a\b\aspnet20sample\InlineCSManifest" /port:8080 Copied template config file 'C:\Program Files (x86)\IIS Express\AppServer\applicationhost.config' to 'C:\Users\User\AppData\Local\Temp\iisexpress\applicationhost20165114341444.config' Updated configuration file 'C:\Users\User\AppData\Local\Temp\iisexpress\applicationhost20165114341444.config' with given cmd line info. Starting IIS Express ... Successfully registered URL "http://localhost:8080/" for site "Development Web Site" application "/" Registration completed IIS Express is running. Enter 'Q' to stop IIS Express Request started: "GET" http://localhost:8080/ Request ended: http://localhost:8080/default.aspx with HTTP status 200.0 Stopping IIS Express ... IIS Express stopped.
Files for the example of isolation unmanaged IIS applications described at: http://www.mazecomputer.com/sxs/help/iis7config.htm.
Programs and DDLs premade for the second project in the "Quick Start Guide" at: http://www.mazecomputer.com/sxs/help/quick.htm.
Examples for programmers illustrating the use of Activation Context API:
- Find activation context sections for a number of GUIDs
- Find interface information in the activation context
- Enumerate items in the activation context
- Find activation context items by name
COM DLL used in examples. Run Visual Studio as Administrator to build this solution.
.Net DLL with embedded manifest used in examples.
.Net program using ClrClass library; no win32 SxS involved.
Unmanaged program using win32 SxS to access ClrClassLibrary. This project has a pre-created manifest and uses Visual Studio project's Manifest Tool to embed the program manifest. See Project Properties, Manifest Tool, Input and Output, Additional Manifest Files.
Load a DLL using LoadLibraryEx Windows API. Illustrates load behavior: Build the project and run "LoadDLL sampleDLL". The DLL is loaded from the 'sample' subfolder because of program manifest. Next run "LoadDLL .\sampleDLL" - this time the DLL is loaded from the current directory because a path is specified in the call to LoadLibraryEx. Now delete the program manifest (LoadDLL.exe.manifest) and run "LoadDLL sampleDLL" again. This time the DLL is loaded fom the program folder because there is no manifest and standard Windows load sequence applies.
Note that once Windows sees the EXE with no manifest, it will remember this and will not use the manifest until the EXE timestamp is changed. Just rebuild the project to get back to the original configuration.
Load a type library using LoadTypeLibEx Windows API. As above the result depends on the presence of program manifest. There is no simple way to query the path the type library was loaded from so follows these steps:
LoadTLB sampleDLL.dll, the call succeeds.
LoadTLB .\sampleDLL.dll, the call also succeeds.
- Delete sampleDLL.dll from the current folder.
LoadTLB sampleDLL.dll, type library is loaded from sample subfolder.
LoadTLB .\sampleDLL.dll, the call fails, the file does not exist.
- Delete sampleDLL.dll from the 'sample' subfolder.
LoadTLB sampleDLL.dll, the call fails.
LoadTLB .\sampleDLL.dll, the call fails.
Illustration for "Duplicate Progids Explained" topic at: http://www.mazecomputer.com/sxs/help/progids.htm.
MFC GUI program illustrating using win32 side-by-side. Build the solution and run the program. There are four parts in the UI. The first shows the result of LoadLibrary, the second CoCreateInstance using a ProgID and the third CoCreateInstance using a class GUID. The fourth part of the window displays paths for this program: the current working directory, the program directory and the assembly root/probing folder. By default the probing folder is empty and side-by-side uses the manifest folder as the search root. You can change it here to experiment with settings you may need for your configuration. "Test Default!" menu action runs the test using default manifest. "Test Manifest!" action promptr for a manifest path and runs these same tests but using an explicit manifest and CreateActCtx, ActivateActCtx windows API.
vs2012, vs2013, vs2015
Example Visual Studio integration projects. Detailed description is in Manifest Maker tutorial. Go to http://www.mazecomputer.com/sxs/help/howto.htm and look for section "Using Manifest Maker with Visual Studio".
Visual Studio example are included in a separate section. See below for links.
- Manifest Maker command line options...
- Visual Studio 2012 integration
- Visual Studio 2013 integration
- Visual Studio 2015 integration
- Visual Studio 2017 integration
- Read more about using the activation context API...
- Enabling an Assembly in an Application Without Extensions
- Enabling an Assembly in an Application Hosting a DLL, Extension, or Control Panel